multiplier suffixes are short, store them directly in struct suffix_mult
authorDenis Vlasenko <vda.linux@googlemail.com>
Fri, 27 Jul 2007 15:06:25 +0000 (15:06 -0000)
committerDenis Vlasenko <vda.linux@googlemail.com>
Fri, 27 Jul 2007 15:06:25 +0000 (15:06 -0000)
function                                             old     new   delta
xstrtoul_range_sfx                                   226     217      -9
xstrtoull_range_sfx                                  291     280     -11
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-20)             Total: -20 bytes
   text    data     bss     dec     hex filename
 669128    2668   13616  685412   a7564 busybox_old
 669108    2668   13616  685392   a7550 busybox_unstripped

coreutils/dd.c
coreutils/head.c
coreutils/od_bloaty.c
coreutils/sleep.c
coreutils/split.c
coreutils/stty.c
coreutils/tail.c
findutils/find.c
include/libbb.h
runit/svlogd.c
util-linux/hexdump.c

index 75cf3732e43437267c082a72b9dd0d439ffa15f0..7247f55e0fd03c5419108511e940df9638ed32e6 100644 (file)
@@ -25,7 +25,7 @@ static const struct suffix_mult dd_suffixes[] = {
        { "M", 1048576 },
        { "GD", 1000000000 },
        { "G", 1073741824 },
-       { NULL, 0 }
+       { }
 };
 
 struct globals {
index 1700af27ab9959eed524adbbc6d0d514063515d9..bffba4043b5aeed4c01405d5c7f9cefcb4fcd603 100644 (file)
@@ -25,7 +25,7 @@ static const struct suffix_mult head_suffixes[] = {
        { "b", 512 },
        { "k", 1024 },
        { "m", 1024*1024 },
-       { NULL, 0 }
+       { }
 };
 #endif
 
index 803407224c7818665a7b276ed0c057d3a59fd927..e3086054462f00b14850fce74253555e585c5963 100644 (file)
@@ -981,7 +981,7 @@ parse_old_offset(const char *s, off_t *offset)
        static const struct suffix_mult Bb[] = {
                { "B", 1024 },
                { "b", 512 },
-               { NULL, 0 }
+               { }
        };
        char *p;
        int radix;
@@ -1204,7 +1204,7 @@ int od_main(int argc, char **argv)
                { "b", 512 },
                { "k", 1024 },
                { "m", 1024*1024 },
-               { NULL, 0 }
+               { }
        };
        unsigned opt;
        int l_c_m;
index e9a30daf26ca75fe116136b34f571a048bdf2e16..26cdbc470b43382d1982d4c811dc0ff09b90e001 100644 (file)
@@ -29,7 +29,7 @@ static const struct suffix_mult sfx[] = {
        { "m", 60 },
        { "h", 60*60 },
        { "d", 24*60*60 },
-       { NULL, 0 }
+       { }
 };
 #endif
 
index 7b4f8c2c04349d88c0b3bb275ce40ca0622cb64c..d1eb82955b93054f3957519d35f56a8bea6c28de 100644 (file)
@@ -20,7 +20,7 @@ static const struct suffix_mult split_suffices[] = {
 #if ENABLE_FEATURE_SPLIT_FANCY
        { "g", 1024*1024*1024 },
 #endif
-       { NULL, 0 }
+       { }
 };
 
 /* Increment the suffix part of the filename.
index b73e2eaced6c4e7ba4d159a16fd9e925c9422be4..fbb72baa94da8950429a62d0206c5fa9076f0c36 100644 (file)
@@ -524,10 +524,10 @@ static void display_window_size(const int fancy)
 }
 
 static const struct suffix_mult stty_suffixes[] = {
-       {"b",  512 },
-       {"k",  1024},
-       {"B",  1024},
-       {NULL, 0   }
+       { "b",  512 },
+       { "k", 1024 },
+       { "B", 1024 },
+       { }
 };
 
 static const struct mode_info *find_mode(const char *name)
index e0d21ed3446a49f3f659233f5a5ee88139ea68b8..01469169a76b1fa010ef8016ef3bd1b046edd704 100644 (file)
@@ -30,7 +30,7 @@ static const struct suffix_mult tail_suffixes[] = {
        { "b", 512 },
        { "k", 1024 },
        { "m", 1024*1024 },
-       { NULL, 0 }
+       { }
 };
 
 struct globals {
index eaf1d59469b6c05d1b87925356edfd0fdb8a4cf0..47cba7c88bb308670c5bb0a84c50333482ad03d2 100644 (file)
@@ -760,10 +760,10 @@ static action*** parse_params(char **argv)
                        static const struct suffix_mult find_suffixes[] = {
                                { "c", 1 },
                                { "w", 2 },
-                               { "b"+1, 512 },
+                               { "", 512 },
                                { "b", 512 },
                                { "k", 1024 },
-                               { NULL, 0 }
+                               { }
                        };
                        action_size *ap;
                        ap = ALLOC_ACTION(size);
index b438ec25f2ea80384e565eac24bd5ed483081ad3..780bd4566444ce6f28b74be5ace8f7def6e3fb08 100644 (file)
@@ -451,7 +451,7 @@ const char *make_human_readable_str(unsigned long long size,
 char *bin2hex(char *buf, const char *cp, int count);
 
 struct suffix_mult {
-       const char *suffix;
+       char suffix[4];
        unsigned mult;
 };
 #include "xatonum.h"
index 08e0b64469b33fa707828e9418161db025151bd6..b271b743f9e918d3c36f39cc7d4ddb69f05f0bbf 100644 (file)
@@ -488,9 +488,9 @@ static unsigned logdir_open(struct logdir *ld, const char *fn)
                                break;
                        case 's': {
                                static const struct suffix_mult km_suffixes[] = {
-                                               { "k", 1024 },
-                                               { "m", 1024*1024 },
-                                               { NULL, 0 }
+                                       { "k", 1024 },
+                                       { "m", 1024*1024 },
+                                       { }
                                };
                                ld->sizemax = xatou_sfx(&s[1], km_suffixes);
                                break;
@@ -503,10 +503,10 @@ static unsigned logdir_open(struct logdir *ld, const char *fn)
                                break;
                        case 't': {
                                static const struct suffix_mult mh_suffixes[] = {
-                                               { "m", 60 },
-                                               { "h", 60*60 },
-                                               /*{ "d", 24*60*60 },*/
-                                               { NULL, 0 }
+                                       { "m", 60 },
+                                       { "h", 60*60 },
+                                       /*{ "d", 24*60*60 },*/
+                                       { }
                                };
                                ld->tmax = xatou_sfx(&s[1], mh_suffixes);
                                if (ld->tmax) {
index 36ed1e97c79c02c0f0550a54fa9a4dffde3db897..213f6071b69c281ce3c9453616584774cd58dd12 100644 (file)
@@ -48,10 +48,10 @@ static const char add_first[] = "\"%07.7_Ax\n\"";
 static const char hexdump_opts[] = "bcdoxCe:f:n:s:v";
 
 static const struct suffix_mult suffixes[] = {
-       { "b",  512 },
-       { "k",  1024 },
-       { "m",  1024*1024 },
-       { NULL, 0 }
+       { "b", 512 },
+       { "k", 1024 },
+       { "m", 1024*1024 },
+       { }
 };
 
 int hexdump_main(int argc, char **argv);