aboutsummaryrefslogtreecommitdiff
path: root/networking/ip.c
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2007-07-24 15:54:42 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2007-07-24 15:54:42 +0000
commit990d0f63eeb502c8762076e5c5499196e09cba55 (patch)
tree30a2091a8159b1694d65f9952e2aba2667d7dc11 /networking/ip.c
parentbcb66ec22e82f6b1ab93f3aec917269393a5b464 (diff)
downloadbusybox-990d0f63eeb502c8762076e5c5499196e09cba55.tar.gz
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.c19
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)
int ip_main(int argc, char **argv);
int ip_main(int argc, char **argv)
{
- const char * const keywords[] = {
- USE_FEATURE_IP_ADDRESS("address",)
- USE_FEATURE_IP_ROUTE("route",)
- USE_FEATURE_IP_LINK("link",)
- USE_FEATURE_IP_TUNNEL("tunnel", "tunl",)
- USE_FEATURE_IP_RULE("rule",)
- NULL
- };
+ static const char keywords[] =
+ USE_FEATURE_IP_ADDRESS("address\0")
+ USE_FEATURE_IP_ROUTE("route\0")
+ USE_FEATURE_IP_LINK("link\0")
+ USE_FEATURE_IP_TUNNEL("tunnel\0" "tunl\0")
+ USE_FEATURE_IP_RULE("rule\0")
+ ;
enum {
USE_FEATURE_IP_ADDRESS(IP_addr,)
USE_FEATURE_IP_ROUTE(IP_route,)
@@ -101,7 +100,7 @@ int ip_main(int argc, char **argv)
ip_parse_common_args(&argc, &argv);
if (argc > 1) {
- int key = index_in_substr_array(keywords, argv[1]);
+ int key = index_in_substrings(keywords, argv[1]);
argc -= 2;
argv += 2;
#if ENABLE_FEATURE_IP_ADDRESS
@@ -125,7 +124,7 @@ int ip_main(int argc, char **argv)
ip_func = do_iprule;
#endif
}
- return (ip_func(argc, argv));
+ return ip_func(argc, argv);
}
#endif /* any of ENABLE_FEATURE_IP_xxx is 1 */