diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2007-07-24 15:54:42 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2007-07-24 15:54:42 +0000 |
commit | 990d0f63eeb502c8762076e5c5499196e09cba55 (patch) | |
tree | 30a2091a8159b1694d65f9952e2aba2667d7dc11 /networking/arp.c | |
parent | bcb66ec22e82f6b1ab93f3aec917269393a5b464 (diff) | |
download | busybox-w32-990d0f63eeb502c8762076e5c5499196e09cba55.tar.gz busybox-w32-990d0f63eeb502c8762076e5c5499196e09cba55.tar.bz2 busybox-w32-990d0f63eeb502c8762076e5c5499196e09cba55.zip |
Replace index_in_[sub]str_array with index_in_[sub]strings,
which scans thru "abc\0def\0123\0\0" type strings. Saves 250 bytes.
text data bss dec hex filename
781266 1328 11844 794438 c1f46 busybox_old
781010 1328 11844 794182 c1e46 busybox_unstripped
Diffstat (limited to 'networking/arp.c')
-rw-r--r-- | networking/arp.c | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/networking/arp.c b/networking/arp.c index e529257a8..907433b4a 100644 --- a/networking/arp.c +++ b/networking/arp.c | |||
@@ -46,17 +46,15 @@ static int sockfd; /* active socket descriptor */ | |||
46 | static smallint hw_set; /* flag if hw-type was set (-H) */ | 46 | static smallint hw_set; /* flag if hw-type was set (-H) */ |
47 | static const char *device = ""; /* current device */ | 47 | static const char *device = ""; /* current device */ |
48 | 48 | ||
49 | static const char *const options[] = { | 49 | static const char options[] = |
50 | "pub", | 50 | "pub\0" |
51 | "priv", | 51 | "priv\0" |
52 | "temp", | 52 | "temp\0" |
53 | "trail", | 53 | "trail\0" |
54 | "dontpub", | 54 | "dontpub\0" |
55 | "auto", | 55 | "auto\0" |
56 | "dev", | 56 | "dev\0" |
57 | "netmask", | 57 | "netmask\0"; |
58 | NULL | ||
59 | }; | ||
60 | 58 | ||
61 | /* Delete an entry from the ARP cache. */ | 59 | /* Delete an entry from the ARP cache. */ |
62 | /* Called only from main, once */ | 60 | /* Called only from main, once */ |
@@ -85,7 +83,7 @@ static int arp_del(char **args) | |||
85 | req.arp_flags = ATF_PERM; | 83 | req.arp_flags = ATF_PERM; |
86 | args++; | 84 | args++; |
87 | while (*args != NULL) { | 85 | while (*args != NULL) { |
88 | switch (index_in_str_array(options, *args)) { | 86 | switch (index_in_strings(options, *args)) { |
89 | case 0: /* "pub" */ | 87 | case 0: /* "pub" */ |
90 | flags |= 1; | 88 | flags |= 1; |
91 | args++; | 89 | args++; |
@@ -239,7 +237,7 @@ static int arp_set(char **args) | |||
239 | /* Check out any modifiers. */ | 237 | /* Check out any modifiers. */ |
240 | flags = ATF_PERM | ATF_COM; | 238 | flags = ATF_PERM | ATF_COM; |
241 | while (*args != NULL) { | 239 | while (*args != NULL) { |
242 | switch (index_in_str_array(options, *args)) { | 240 | switch (index_in_strings(options, *args)) { |
243 | case 0: /* "pub" */ | 241 | case 0: /* "pub" */ |
244 | flags |= ATF_PUBL; | 242 | flags |= ATF_PUBL; |
245 | args++; | 243 | args++; |