From ed6a49c657ae204f6ba8ad84315fa04c09297a7c Mon Sep 17 00:00:00 2001 From: Denis Vlasenko Date: Sun, 18 Nov 2007 22:56:25 +0000 Subject: ip: stop propagating argc; optimize ip_parse_common_args function old new delta find_pair 167 187 +20 static.families - 17 +17 die_must_be_on_off - 11 +11 ... on_off 33 22 -11 do_ipaddr 103 90 -13 do_iptunnel 1001 986 -15 iproute_list_or_flush 1237 1217 -20 static.ip_common_commands 43 22 -21 do_iproute 2217 2193 -24 parse_args 1444 1414 -30 ip_do 47 16 -31 do_iprule 994 963 -31 ip_main 153 113 -40 ipaddr_modify 1357 1305 -52 ipaddr_list_or_flush 2543 2490 -53 ip_parse_common_args 294 159 -135 ------------------------------------------------------------------------------ (add/remove: 4/1 grow/shrink: 4/24 up/down: 85/-563) Total: -478 bytes text data bss dec hex filename 775561 966 9236 785763 bfd63 busybox_old 775073 962 9236 785271 bfb77 busybox_unstripped --- include/libbb.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'include') diff --git a/include/libbb.h b/include/libbb.h index 2593c3ad2..3bec43233 100644 --- a/include/libbb.h +++ b/include/libbb.h @@ -289,6 +289,30 @@ void xpipe(int filedes[2]); off_t xlseek(int fd, off_t offset, int whence); off_t fdlength(int fd); +/* Useful for having small structure members/global variables */ +typedef int8_t socktype_t; +typedef int8_t family_t; +struct BUG_too_small { + char BUG_socktype_t_too_small[(0 + | SOCK_STREAM + | SOCK_DGRAM + | SOCK_RDM + | SOCK_SEQPACKET + | SOCK_RAW + ) <= 127 ? 1 : -1]; + char BUG_family_t_too_small[(0 + | AF_UNSPEC + | AF_INET + | AF_INET6 + | AF_UNIX + | AF_PACKET + | AF_NETLINK + /* | AF_DECnet */ + /* | AF_IPX */ + ) <= 127 ? 1 : -1]; +}; + + int xsocket(int domain, int type, int protocol); void xbind(int sockfd, struct sockaddr *my_addr, socklen_t addrlen); void xlisten(int s, int backlog); -- cgit v1.2.3