aboutsummaryrefslogtreecommitdiff
path: root/networking/libiproute/iplink.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/libiproute/iplink.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/libiproute/iplink.c')
-rw-r--r--networking/libiproute/iplink.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/networking/libiproute/iplink.c b/networking/libiproute/iplink.c
index 3d3ea2a23..69ce84e49 100644
--- a/networking/libiproute/iplink.c
+++ b/networking/libiproute/iplink.c
@@ -171,16 +171,15 @@ static int do_set(int argc, char **argv)
struct ifreq ifr0, ifr1;
char *newname = NULL;
int htype, halen;
- static const char * const keywords[] = {
- "up", "down", "name", "mtu", "multicast", "arp", "addr", "dev",
- "on", "off", NULL
- };
+ static const char keywords[] =
+ "up\0""down\0""name\0""mtu\0""multicast\0""arp\0""addr\0""dev\0"
+ "on\0""off\0";
enum { ARG_up = 1, ARG_down, ARG_name, ARG_mtu, ARG_multicast, ARG_arp,
ARG_addr, ARG_dev, PARM_on, PARM_off };
smalluint key;
while (argc > 0) {
- key = index_in_str_array(keywords, *argv) + 1;
+ key = index_in_strings(keywords, *argv) + 1;
if (key == ARG_up) {
mask |= IFF_UP;
flags |= IFF_UP;
@@ -199,7 +198,7 @@ static int do_set(int argc, char **argv)
} else if (key == ARG_multicast) {
NEXT_ARG();
mask |= IFF_MULTICAST;
- key = index_in_str_array(keywords, *argv) + 1;
+ key = index_in_strings(keywords, *argv) + 1;
if (key == PARM_on) {
flags |= IFF_MULTICAST;
} else if (key == PARM_off) {
@@ -209,7 +208,7 @@ static int do_set(int argc, char **argv)
} else if (key == ARG_arp) {
NEXT_ARG();
mask |= IFF_NOARP;
- key = index_in_str_array(keywords, *argv) + 1;
+ key = index_in_strings(keywords, *argv) + 1;
if (key == PARM_on) {
flags &= ~IFF_NOARP;
} else if (key == PARM_off) {
@@ -276,13 +275,12 @@ static int ipaddr_list_link(int argc, char **argv)
/* Return value becomes exitcode. It's okay to not return at all */
int do_iplink(int argc, char **argv)
{
- static const char * const keywords[] = {
- "set", "show", "lst", "list", NULL
- };
+ static const char keywords[] =
+ "set\0""show\0""lst\0""list\0";
smalluint key;
if (argc <= 0)
return ipaddr_list_link(0, NULL);
- key = index_in_substr_array(keywords, *argv) + 1;
+ key = index_in_substrings(keywords, *argv) + 1;
if (key == 0)
bb_error_msg_and_die(bb_msg_invalid_arg, *argv, applet_name);
argc--; argv++;