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/ip.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/ip.c')
-rw-r--r-- | networking/ip.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/networking/ip.c b/networking/ip.c index 0105bd98b..bf7e84c53 100644 --- a/networking/ip.c +++ b/networking/ip.c | |||
@@ -82,14 +82,13 @@ int iptunnel_main(int argc, char **argv) | |||
82 | int ip_main(int argc, char **argv); | 82 | int ip_main(int argc, char **argv); |
83 | int ip_main(int argc, char **argv) | 83 | int ip_main(int argc, char **argv) |
84 | { | 84 | { |
85 | const char * const keywords[] = { | 85 | static const char keywords[] = |
86 | USE_FEATURE_IP_ADDRESS("address",) | 86 | USE_FEATURE_IP_ADDRESS("address\0") |
87 | USE_FEATURE_IP_ROUTE("route",) | 87 | USE_FEATURE_IP_ROUTE("route\0") |
88 | USE_FEATURE_IP_LINK("link",) | 88 | USE_FEATURE_IP_LINK("link\0") |
89 | USE_FEATURE_IP_TUNNEL("tunnel", "tunl",) | 89 | USE_FEATURE_IP_TUNNEL("tunnel\0" "tunl\0") |
90 | USE_FEATURE_IP_RULE("rule",) | 90 | USE_FEATURE_IP_RULE("rule\0") |
91 | NULL | 91 | ; |
92 | }; | ||
93 | enum { | 92 | enum { |
94 | USE_FEATURE_IP_ADDRESS(IP_addr,) | 93 | USE_FEATURE_IP_ADDRESS(IP_addr,) |
95 | USE_FEATURE_IP_ROUTE(IP_route,) | 94 | USE_FEATURE_IP_ROUTE(IP_route,) |
@@ -101,7 +100,7 @@ int ip_main(int argc, char **argv) | |||
101 | 100 | ||
102 | ip_parse_common_args(&argc, &argv); | 101 | ip_parse_common_args(&argc, &argv); |
103 | if (argc > 1) { | 102 | if (argc > 1) { |
104 | int key = index_in_substr_array(keywords, argv[1]); | 103 | int key = index_in_substrings(keywords, argv[1]); |
105 | argc -= 2; | 104 | argc -= 2; |
106 | argv += 2; | 105 | argv += 2; |
107 | #if ENABLE_FEATURE_IP_ADDRESS | 106 | #if ENABLE_FEATURE_IP_ADDRESS |
@@ -125,7 +124,7 @@ int ip_main(int argc, char **argv) | |||
125 | ip_func = do_iprule; | 124 | ip_func = do_iprule; |
126 | #endif | 125 | #endif |
127 | } | 126 | } |
128 | return (ip_func(argc, argv)); | 127 | return ip_func(argc, argv); |
129 | } | 128 | } |
130 | 129 | ||
131 | #endif /* any of ENABLE_FEATURE_IP_xxx is 1 */ | 130 | #endif /* any of ENABLE_FEATURE_IP_xxx is 1 */ |