summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2007-07-27 15:30:39 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2007-07-27 15:30:39 +0000
commit1bab1de69866c38c3e9924d23f21a90623a0a6dc (patch)
treecabe111142bea9de4c2ca0de3ad8a9ccd7e242e5
parentf868963c672ffdfc4bd37670b8d74342577264b1 (diff)
downloadbusybox-w32-1bab1de69866c38c3e9924d23f21a90623a0a6dc.tar.gz
busybox-w32-1bab1de69866c38c3e9924d23f21a90623a0a6dc.tar.bz2
busybox-w32-1bab1de69866c38c3e9924d23f21a90623a0a6dc.zip
fix for suffix optimization (which was in previous commit)
-rw-r--r--include/libbb.h1
-rw-r--r--libbb/xatonum_template.c2
2 files changed, 2 insertions, 1 deletions
diff --git a/include/libbb.h b/include/libbb.h
index 780bd4566..ddbde1833 100644
--- a/include/libbb.h
+++ b/include/libbb.h
@@ -450,6 +450,7 @@ const char *make_human_readable_str(unsigned long long size,
450/* Put a string of hex bytes ("1b2e66fe"...), return advanced pointer */ 450/* Put a string of hex bytes ("1b2e66fe"...), return advanced pointer */
451char *bin2hex(char *buf, const char *cp, int count); 451char *bin2hex(char *buf, const char *cp, int count);
452 452
453/* Last element is marked by mult == 0 */
453struct suffix_mult { 454struct suffix_mult {
454 char suffix[4]; 455 char suffix[4];
455 unsigned mult; 456 unsigned mult;
diff --git a/libbb/xatonum_template.c b/libbb/xatonum_template.c
index bc8116056..205da53c8 100644
--- a/libbb/xatonum_template.c
+++ b/libbb/xatonum_template.c
@@ -45,7 +45,7 @@ unsigned type xstrtou(_range_sfx)(const char *numstr, int base,
45 * Note that we also allow nul suffixes with associated multipliers, 45 * Note that we also allow nul suffixes with associated multipliers,
46 * to allow for scaling of the numstr by some default multiplier. */ 46 * to allow for scaling of the numstr by some default multiplier. */
47 if (suffixes) { 47 if (suffixes) {
48 while (suffixes->suffix) { 48 while (suffixes->mult) {
49 if (strcmp(suffixes->suffix, e) == 0) { 49 if (strcmp(suffixes->suffix, e) == 0) {
50 if (XSTR_UTYPE_MAX / suffixes->mult < r) 50 if (XSTR_UTYPE_MAX / suffixes->mult < r)
51 goto range; /* overflow! */ 51 goto range; /* overflow! */