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
This commit is contained in:
Denis Vlasenko
2007-07-24 15:54:42 +00:00
parent bcb66ec22e
commit 990d0f63ee
43 changed files with 352 additions and 340 deletions

View File

@@ -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 */