aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2007-07-27 15:06:25 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2007-07-27 15:06:25 +0000
commitf868963c672ffdfc4bd37670b8d74342577264b1 (patch)
tree4966afe1bbfaa0aa8ea313354e8be875307e027c
parent75878706174290fbf5faac0215b3b9ae78fa9d6f (diff)
downloadbusybox-w32-f868963c672ffdfc4bd37670b8d74342577264b1.tar.gz
busybox-w32-f868963c672ffdfc4bd37670b8d74342577264b1.tar.bz2
busybox-w32-f868963c672ffdfc4bd37670b8d74342577264b1.zip
multiplier suffixes are short, store them directly in struct suffix_mult
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
-rw-r--r--coreutils/dd.c2
-rw-r--r--coreutils/head.c2
-rw-r--r--coreutils/od_bloaty.c4
-rw-r--r--coreutils/sleep.c2
-rw-r--r--coreutils/split.c2
-rw-r--r--coreutils/stty.c8
-rw-r--r--coreutils/tail.c2
-rw-r--r--findutils/find.c4
-rw-r--r--include/libbb.h2
-rw-r--r--runit/svlogd.c14
-rw-r--r--util-linux/hexdump.c8
11 files changed, 25 insertions, 25 deletions
diff --git a/coreutils/dd.c b/coreutils/dd.c
index 75cf3732e..7247f55e0 100644
--- a/coreutils/dd.c
+++ b/coreutils/dd.c
@@ -25,7 +25,7 @@ static const struct suffix_mult dd_suffixes[] = {
25 { "M", 1048576 }, 25 { "M", 1048576 },
26 { "GD", 1000000000 }, 26 { "GD", 1000000000 },
27 { "G", 1073741824 }, 27 { "G", 1073741824 },
28 { NULL, 0 } 28 { }
29}; 29};
30 30
31struct globals { 31struct globals {
diff --git a/coreutils/head.c b/coreutils/head.c
index 1700af27a..bffba4043 100644
--- a/coreutils/head.c
+++ b/coreutils/head.c
@@ -25,7 +25,7 @@ static const struct suffix_mult head_suffixes[] = {
25 { "b", 512 }, 25 { "b", 512 },
26 { "k", 1024 }, 26 { "k", 1024 },
27 { "m", 1024*1024 }, 27 { "m", 1024*1024 },
28 { NULL, 0 } 28 { }
29}; 29};
30#endif 30#endif
31 31
diff --git a/coreutils/od_bloaty.c b/coreutils/od_bloaty.c
index 803407224..e30860544 100644
--- a/coreutils/od_bloaty.c
+++ b/coreutils/od_bloaty.c
@@ -981,7 +981,7 @@ parse_old_offset(const char *s, off_t *offset)
981 static const struct suffix_mult Bb[] = { 981 static const struct suffix_mult Bb[] = {
982 { "B", 1024 }, 982 { "B", 1024 },
983 { "b", 512 }, 983 { "b", 512 },
984 { NULL, 0 } 984 { }
985 }; 985 };
986 char *p; 986 char *p;
987 int radix; 987 int radix;
@@ -1204,7 +1204,7 @@ int od_main(int argc, char **argv)
1204 { "b", 512 }, 1204 { "b", 512 },
1205 { "k", 1024 }, 1205 { "k", 1024 },
1206 { "m", 1024*1024 }, 1206 { "m", 1024*1024 },
1207 { NULL, 0 } 1207 { }
1208 }; 1208 };
1209 unsigned opt; 1209 unsigned opt;
1210 int l_c_m; 1210 int l_c_m;
diff --git a/coreutils/sleep.c b/coreutils/sleep.c
index e9a30daf2..26cdbc470 100644
--- a/coreutils/sleep.c
+++ b/coreutils/sleep.c
@@ -29,7 +29,7 @@ static const struct suffix_mult sfx[] = {
29 { "m", 60 }, 29 { "m", 60 },
30 { "h", 60*60 }, 30 { "h", 60*60 },
31 { "d", 24*60*60 }, 31 { "d", 24*60*60 },
32 { NULL, 0 } 32 { }
33}; 33};
34#endif 34#endif
35 35
diff --git a/coreutils/split.c b/coreutils/split.c
index 7b4f8c2c0..d1eb82955 100644
--- a/coreutils/split.c
+++ b/coreutils/split.c
@@ -20,7 +20,7 @@ static const struct suffix_mult split_suffices[] = {
20#if ENABLE_FEATURE_SPLIT_FANCY 20#if ENABLE_FEATURE_SPLIT_FANCY
21 { "g", 1024*1024*1024 }, 21 { "g", 1024*1024*1024 },
22#endif 22#endif
23 { NULL, 0 } 23 { }
24}; 24};
25 25
26/* Increment the suffix part of the filename. 26/* Increment the suffix part of the filename.
diff --git a/coreutils/stty.c b/coreutils/stty.c
index b73e2eace..fbb72baa9 100644
--- a/coreutils/stty.c
+++ b/coreutils/stty.c
@@ -524,10 +524,10 @@ static void display_window_size(const int fancy)
524} 524}
525 525
526static const struct suffix_mult stty_suffixes[] = { 526static const struct suffix_mult stty_suffixes[] = {
527 {"b", 512 }, 527 { "b", 512 },
528 {"k", 1024}, 528 { "k", 1024 },
529 {"B", 1024}, 529 { "B", 1024 },
530 {NULL, 0 } 530 { }
531}; 531};
532 532
533static const struct mode_info *find_mode(const char *name) 533static const struct mode_info *find_mode(const char *name)
diff --git a/coreutils/tail.c b/coreutils/tail.c
index e0d21ed34..01469169a 100644
--- a/coreutils/tail.c
+++ b/coreutils/tail.c
@@ -30,7 +30,7 @@ static const struct suffix_mult tail_suffixes[] = {
30 { "b", 512 }, 30 { "b", 512 },
31 { "k", 1024 }, 31 { "k", 1024 },
32 { "m", 1024*1024 }, 32 { "m", 1024*1024 },
33 { NULL, 0 } 33 { }
34}; 34};
35 35
36struct globals { 36struct globals {
diff --git a/findutils/find.c b/findutils/find.c
index eaf1d5946..47cba7c88 100644
--- a/findutils/find.c
+++ b/findutils/find.c
@@ -760,10 +760,10 @@ static action*** parse_params(char **argv)
760 static const struct suffix_mult find_suffixes[] = { 760 static const struct suffix_mult find_suffixes[] = {
761 { "c", 1 }, 761 { "c", 1 },
762 { "w", 2 }, 762 { "w", 2 },
763 { "b"+1, 512 }, 763 { "", 512 },
764 { "b", 512 }, 764 { "b", 512 },
765 { "k", 1024 }, 765 { "k", 1024 },
766 { NULL, 0 } 766 { }
767 }; 767 };
768 action_size *ap; 768 action_size *ap;
769 ap = ALLOC_ACTION(size); 769 ap = ALLOC_ACTION(size);
diff --git a/include/libbb.h b/include/libbb.h
index b438ec25f..780bd4566 100644
--- a/include/libbb.h
+++ b/include/libbb.h
@@ -451,7 +451,7 @@ const char *make_human_readable_str(unsigned long long size,
451char *bin2hex(char *buf, const char *cp, int count); 451char *bin2hex(char *buf, const char *cp, int count);
452 452
453struct suffix_mult { 453struct suffix_mult {
454 const char *suffix; 454 char suffix[4];
455 unsigned mult; 455 unsigned mult;
456}; 456};
457#include "xatonum.h" 457#include "xatonum.h"
diff --git a/runit/svlogd.c b/runit/svlogd.c
index 08e0b6446..b271b743f 100644
--- a/runit/svlogd.c
+++ b/runit/svlogd.c
@@ -488,9 +488,9 @@ static unsigned logdir_open(struct logdir *ld, const char *fn)
488 break; 488 break;
489 case 's': { 489 case 's': {
490 static const struct suffix_mult km_suffixes[] = { 490 static const struct suffix_mult km_suffixes[] = {
491 { "k", 1024 }, 491 { "k", 1024 },
492 { "m", 1024*1024 }, 492 { "m", 1024*1024 },
493 { NULL, 0 } 493 { }
494 }; 494 };
495 ld->sizemax = xatou_sfx(&s[1], km_suffixes); 495 ld->sizemax = xatou_sfx(&s[1], km_suffixes);
496 break; 496 break;
@@ -503,10 +503,10 @@ static unsigned logdir_open(struct logdir *ld, const char *fn)
503 break; 503 break;
504 case 't': { 504 case 't': {
505 static const struct suffix_mult mh_suffixes[] = { 505 static const struct suffix_mult mh_suffixes[] = {
506 { "m", 60 }, 506 { "m", 60 },
507 { "h", 60*60 }, 507 { "h", 60*60 },
508 /*{ "d", 24*60*60 },*/ 508 /*{ "d", 24*60*60 },*/
509 { NULL, 0 } 509 { }
510 }; 510 };
511 ld->tmax = xatou_sfx(&s[1], mh_suffixes); 511 ld->tmax = xatou_sfx(&s[1], mh_suffixes);
512 if (ld->tmax) { 512 if (ld->tmax) {
diff --git a/util-linux/hexdump.c b/util-linux/hexdump.c
index 36ed1e97c..213f6071b 100644
--- a/util-linux/hexdump.c
+++ b/util-linux/hexdump.c
@@ -48,10 +48,10 @@ static const char add_first[] = "\"%07.7_Ax\n\"";
48static const char hexdump_opts[] = "bcdoxCe:f:n:s:v"; 48static const char hexdump_opts[] = "bcdoxCe:f:n:s:v";
49 49
50static const struct suffix_mult suffixes[] = { 50static const struct suffix_mult suffixes[] = {
51 { "b", 512 }, 51 { "b", 512 },
52 { "k", 1024 }, 52 { "k", 1024 },
53 { "m", 1024*1024 }, 53 { "m", 1024*1024 },
54 { NULL, 0 } 54 { }
55}; 55};
56 56
57int hexdump_main(int argc, char **argv); 57int hexdump_main(int argc, char **argv);