diff options
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/util-common.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/src/common/util-common.c b/src/common/util-common.c index 542dcfde..0b67d85a 100644 --- a/src/common/util-common.c +++ b/src/common/util-common.c @@ -144,17 +144,13 @@ size_t strtrim(char *str) } if(pch != str) { size_t len = strlen(pch); - if(len) { - memmove(str, pch, len + 1); - pch = str; - } else { + /* check if there wasn't anything but whitespace in the string. */ + if(len == 0) { *str = '\0'; + return 0; } - } - - /* check if there wasn't anything but whitespace in the string. */ - if(*str == '\0') { - return 0; + memmove(str, pch, len + 1); + pch = str; } end = (str + strlen(str) - 1); |