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/slattach.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) (limited to 'networking/slattach.c') diff --git a/networking/slattach.c b/networking/slattach.c index 1a4423b72..4bac879d2 100644 --- a/networking/slattach.c +++ b/networking/slattach.c @@ -16,16 +16,6 @@ #include "libbb.h" #include "libiproute/utils.h" /* invarg() */ -/* Line discipline code table */ -static const char *const proto_names[] = { - "cslip"+1, /* 0 */ - "cslip", /* 1 */ - "cslip6"+1, /* 2 */ - "cslip6", /* 3 */ - "adaptive", /* 8 */ - NULL -}; - struct globals { int handle; int saved_disc; @@ -132,6 +122,15 @@ static void sig_handler(int signo) int slattach_main(int argc, char **argv); int slattach_main(int argc, char **argv) { + /* Line discipline code table */ + static const char proto_names[] = + "slip\0" /* 0 */ + "cslip\0" /* 1 */ + "slip6\0" /* 2 */ + "cslip6\0" /* 3 */ + "adaptive\0" /* 8 */ + ; + int i, encap, opt; struct termios state; const char *proto = "cslip"; @@ -160,7 +159,7 @@ int slattach_main(int argc, char **argv) if (!*argv) bb_show_usage(); - encap = index_in_str_array(proto_names, proto); + encap = index_in_strings(proto_names, proto); if (encap < 0) invarg(proto, "protocol"); -- cgit v1.2.3