diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2009-10-22 22:28:08 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2009-10-22 22:28:08 +0200 |
commit | c0dab37d0a2e079d0e0c85aa979439373e9096ca (patch) | |
tree | a9604c6673dfef0726eebba516c5674bcf40ef3e /libbb/trim.c | |
parent | 6935ec9c0b2ac58b1ddc206c21bea36582e1f233 (diff) | |
download | busybox-w32-c0dab37d0a2e079d0e0c85aa979439373e9096ca.tar.gz busybox-w32-c0dab37d0a2e079d0e0c85aa979439373e9096ca.tar.bz2 busybox-w32-c0dab37d0a2e079d0e0c85aa979439373e9096ca.zip |
*: remove last function calls to isspace
function old new delta
xstrtoul_range_sfx 232 231 -1
xstrtoull_range_sfx 295 293 -2
trim 82 80 -2
trim_trailing_spaces_and_print 57 52 -5
isspace 18 - -18
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'libbb/trim.c')
-rw-r--r-- | libbb/trim.c | 9 |
1 files changed, 4 insertions, 5 deletions
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'; |