diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2007-10-29 19:22:13 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2007-10-29 19:22:13 +0000 |
commit | 5a28a25b9dd81e0975532458723c4244ff532e58 (patch) | |
tree | 53d30dbcfb05156500451389d47827487564b257 /libbb/trim.c | |
parent | 63430ae35ad98d5946851e8a366379dd1574f2a2 (diff) |
syscall: code shrink
text data bss dec hex filename
777209 974 9676 787859 c0593 busybox_old
777042 974 9676 787692 c04ec busybox_unstripped
Diffstat (limited to 'libbb/trim.c')
-rw-r--r-- | libbb/trim.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/libbb/trim.c b/libbb/trim.c index 4957d7276..94ccaf7ed 100644 --- a/libbb/trim.c +++ b/libbb/trim.c @@ -16,12 +16,16 @@ void trim(char *s) size_t lws; /* trim trailing whitespace */ - while (len && isspace(s[len-1])) --len; + while (len && isspace(s[len-1])) + --len; /* trim leading whitespace */ if (len) { lws = strspn(s, " \n\r\t\v"); - memmove(s, s + lws, len -= lws); + if (lws) { + len -= lws; + memmove(s, s + lws, len); + } } s[len] = '\0'; } |