diff options
Diffstat (limited to 'libbb')
-rw-r--r-- | libbb/getopt32.c | 2 | ||||
-rw-r--r-- | libbb/xatonum.c | 3 | ||||
-rw-r--r-- | libbb/xatonum_template.c | 6 |
3 files changed, 5 insertions, 6 deletions
diff --git a/libbb/getopt32.c b/libbb/getopt32.c index dddf8121a..50343fdab 100644 --- a/libbb/getopt32.c +++ b/libbb/getopt32.c @@ -447,7 +447,6 @@ getopt32(int argc, char **argv, const char *applet_opts, ...) } va_end (p); -#if ENABLE_AR || ENABLE_TAR if (spec_flgs & FIRST_ARGV_IS_OPT) { if (argv[1] && argv[1][0] != '-' && argv[1][0] != '\0') { argv[1] = xasprintf("-%s", argv[1]); @@ -455,7 +454,6 @@ getopt32(int argc, char **argv, const char *applet_opts, ...) spec_flgs |= FREE_FIRST_ARGV_IS_OPT; } } -#endif /* Note: just "getopt() <= 0" will not work good for * "fake" short options, like this one: * wget $'-\203' "Test: test" http://kernel.org/ diff --git a/libbb/xatonum.c b/libbb/xatonum.c index 35607c317..dec3c2dc4 100644 --- a/libbb/xatonum.c +++ b/libbb/xatonum.c @@ -34,7 +34,8 @@ #endif #if UINT_MAX != ULONG_MAX -extern inline unsigned bb_strtoui(const char *str, char **end, int b) +static ATTRIBUTE_ALWAYS_INLINE +unsigned bb_strtoui(const char *str, char **end, int b) { unsigned long v = strtoul(str, end, b); if (v > UINT_MAX) { diff --git a/libbb/xatonum_template.c b/libbb/xatonum_template.c index 53ba544eb..ce0199594 100644 --- a/libbb/xatonum_template.c +++ b/libbb/xatonum_template.c @@ -24,7 +24,7 @@ unsigned type xstrtou(_range_sfx)(const char *numstr, int base, /* Disallow '-' and any leading whitespace. Speed isn't critical here * since we're parsing commandline args. So make sure we get the * actual isspace function rather than a lnumstrer macro implementaion. */ - if ((*numstr == '-') || (isspace)(*numstr)) + if (*numstr == '-' || *numstr == '+' || (isspace)(*numstr)) goto inval; /* Since this is a lib function, we're not allowed to reset errno to 0. @@ -36,7 +36,7 @@ unsigned type xstrtou(_range_sfx)(const char *numstr, int base, /* Do the initial validity check. Note: The standards do not * guarantee that errno is set if no digits were found. So we * must test for this explicitly. */ - if (errno || (numstr == e)) + if (errno || numstr == e) goto inval; /* error / no digits / illegal trailing chars */ errno = old_errno; /* Ok. So restore errno. */ @@ -127,7 +127,7 @@ type xstrto(_range_sfx)(const char *numstr, int base, type r; const char *p = numstr; - if ((p[0] == '-') && (p[1] != '+')) { + if (p[0] == '-') { ++p; ++u; /* two's complement */ } |