diff options
Diffstat (limited to 'libbb')
-rw-r--r-- | libbb/ask_confirmation.c | 4 | ||||
-rw-r--r-- | libbb/trim.c | 9 | ||||
-rw-r--r-- | libbb/xatonum_template.c | 5 |
3 files changed, 7 insertions, 11 deletions
diff --git a/libbb/ask_confirmation.c b/libbb/ask_confirmation.c index d08bc515e..9dfbd15cf 100644 --- a/libbb/ask_confirmation.c +++ b/libbb/ask_confirmation.c | |||
@@ -20,9 +20,7 @@ int FAST_FUNC bb_ask_confirmation(void) | |||
20 | int c; | 20 | int c; |
21 | 21 | ||
22 | while (((c = getchar()) != EOF) && (c != '\n')) { | 22 | while (((c = getchar()) != EOF) && (c != '\n')) { |
23 | /* Make sure we get the actual function call for isspace, | 23 | if (first && !isspace(c)) { |
24 | * as speed is not critical here. */ | ||
25 | if (first && !(isspace)(c)) { | ||
26 | --first; | 24 | --first; |
27 | if ((c == 'y') || (c == 'Y')) { | 25 | if ((c == 'y') || (c == 'Y')) { |
28 | ++retval; | 26 | ++retval; |
diff --git a/libbb/trim.c b/libbb/trim.c index ea20ff370..df00b846e 100644 --- a/libbb/trim.c +++ b/libbb/trim.c | |||
@@ -13,7 +13,6 @@ | |||
13 | void FAST_FUNC trim(char *s) | 13 | void FAST_FUNC trim(char *s) |
14 | { | 14 | { |
15 | size_t len = strlen(s); | 15 | size_t len = strlen(s); |
16 | size_t lws; | ||
17 | 16 | ||
18 | /* trim trailing whitespace */ | 17 | /* trim trailing whitespace */ |
19 | while (len && isspace(s[len-1])) | 18 | while (len && isspace(s[len-1])) |
@@ -21,10 +20,10 @@ void FAST_FUNC trim(char *s) | |||
21 | 20 | ||
22 | /* trim leading whitespace */ | 21 | /* trim leading whitespace */ |
23 | if (len) { | 22 | if (len) { |
24 | lws = strspn(s, " \n\r\t\v"); | 23 | char *nws = skip_whitespace(s); |
25 | if (lws) { | 24 | if ((nws - s) != 0) { |
26 | len -= lws; | 25 | len -= (nws - s); |
27 | memmove(s, s + lws, len); | 26 | memmove(s, nws, len); |
28 | } | 27 | } |
29 | } | 28 | } |
30 | s[len] = '\0'; | 29 | s[len] = '\0'; |
diff --git a/libbb/xatonum_template.c b/libbb/xatonum_template.c index 339a7d35f..c97a4b795 100644 --- a/libbb/xatonum_template.c +++ b/libbb/xatonum_template.c | |||
@@ -25,9 +25,8 @@ unsigned type FAST_FUNC xstrtou(_range_sfx)(const char *numstr, int base, | |||
25 | int old_errno; | 25 | int old_errno; |
26 | char *e; | 26 | char *e; |
27 | 27 | ||
28 | /* Disallow '-' and any leading whitespace. Make sure we get the | 28 | /* Disallow '-' and any leading whitespace. */ |
29 | * actual isspace function rather than a macro implementaion. */ | 29 | if (*numstr == '-' || *numstr == '+' || isspace(*numstr)) |
30 | if (*numstr == '-' || *numstr == '+' || (isspace)(*numstr)) | ||
31 | goto inval; | 30 | goto inval; |
32 | 31 | ||
33 | /* Since this is a lib function, we're not allowed to reset errno to 0. | 32 | /* Since this is a lib function, we're not allowed to reset errno to 0. |