From 990d0f63eeb502c8762076e5c5499196e09cba55 Mon Sep 17 00:00:00 2001 From: Denis Vlasenko Date: Tue, 24 Jul 2007 15:54:42 +0000 Subject: 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 --- networking/ip.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'networking/ip.c') 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 */ -- cgit v1.2.3-55-g6feb