diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2007-07-24 15:54:42 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2007-07-24 15:54:42 +0000 |
commit | 990d0f63eeb502c8762076e5c5499196e09cba55 (patch) | |
tree | 30a2091a8159b1694d65f9952e2aba2667d7dc11 /util-linux | |
parent | bcb66ec22e82f6b1ab93f3aec917269393a5b464 (diff) |
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 'util-linux')
-rw-r--r-- | util-linux/getopt.c | 2 | ||||
-rw-r--r-- | util-linux/hwclock.c | 2 | ||||
-rw-r--r-- | util-linux/mount.c | 76 |
3 files changed, 38 insertions, 42 deletions
diff --git a/util-linux/getopt.c b/util-linux/getopt.c index 5ee13ec8b..41299d2c3 100644 --- a/util-linux/getopt.c +++ b/util-linux/getopt.c @@ -276,7 +276,7 @@ static const char getopt_longopts[] = "unquoted\0" No_argument "u" "alternative\0" No_argument "a" "name\0" Required_argument "n" - "\0"; + ; #endif int getopt_main(int argc, char *argv[]); diff --git a/util-linux/hwclock.c b/util-linux/hwclock.c index ff696a3d7..ede95ecaa 100644 --- a/util-linux/hwclock.c +++ b/util-linux/hwclock.c @@ -185,7 +185,7 @@ int hwclock_main(int argc, char **argv) "hctosys\0" No_argument "s" "systohc\0" No_argument "w" "file\0" Required_argument "f" - "\0"; + ; applet_long_options = hwclock_longopts; #endif opt_complementary = "r--ws:w--rs:s--wr:l--u:u--l"; diff --git a/util-linux/mount.c b/util-linux/mount.c index 4dd1a85a2..7ee24ca14 100644 --- a/util-linux/mount.c +++ b/util-linux/mount.c @@ -888,33 +888,31 @@ static int nfsmount(struct mntent *mp, int vfsflags, char *filteropts) if (filteropts) for (opt = strtok(filteropts, ","); opt; opt = strtok(NULL, ",")) { char *opteq = strchr(opt, '='); if (opteq) { - static const char *const options[] = { - /* 0 */ "rsize", - /* 1 */ "wsize", - /* 2 */ "timeo", - /* 3 */ "retrans", - /* 4 */ "acregmin", - /* 5 */ "acregmax", - /* 6 */ "acdirmin", - /* 7 */ "acdirmax", - /* 8 */ "actimeo", - /* 9 */ "retry", - /* 10 */ "port", - /* 11 */ "mountport", - /* 12 */ "mounthost", - /* 13 */ "mountprog", - /* 14 */ "mountvers", - /* 15 */ "nfsprog", - /* 16 */ "nfsvers", - /* 17 */ "vers", - /* 18 */ "proto", - /* 19 */ "namlen", - /* 20 */ "addr", - NULL - }; + static const char options[] = + /* 0 */ "rsize\0" + /* 1 */ "wsize\0" + /* 2 */ "timeo\0" + /* 3 */ "retrans\0" + /* 4 */ "acregmin\0" + /* 5 */ "acregmax\0" + /* 6 */ "acdirmin\0" + /* 7 */ "acdirmax\0" + /* 8 */ "actimeo\0" + /* 9 */ "retry\0" + /* 10 */ "port\0" + /* 11 */ "mountport\0" + /* 12 */ "mounthost\0" + /* 13 */ "mountprog\0" + /* 14 */ "mountvers\0" + /* 15 */ "nfsprog\0" + /* 16 */ "nfsvers\0" + /* 17 */ "vers\0" + /* 18 */ "proto\0" + /* 19 */ "namlen\0" + /* 20 */ "addr\0"; int val = xatoi_u(opteq + 1); *opteq = '\0'; - switch (index_in_str_array(options, opt)) { + switch (index_in_strings(options, opt)) { case 0: // "rsize" data.rsize = val; break; @@ -993,26 +991,24 @@ static int nfsmount(struct mntent *mp, int vfsflags, char *filteropts) } } else { - static const char *const options[] = { - "bg", - "fg", - "soft", - "hard", - "intr", - "posix", - "cto", - "ac", - "tcp", - "udp", - "lock", - NULL - }; + static const char options[] = + "bg\0" + "fg\0" + "soft\0" + "hard\0" + "intr\0" + "posix\0" + "cto\0" + "ac\0" + "tcp\0" + "udp\0" + "lock\0"; int val = 1; if (!strncmp(opt, "no", 2)) { val = 0; opt += 2; } - switch (index_in_str_array(options, opt)) { + switch (index_in_strings(options, opt)) { case 0: // "bg" bg = val; break; |