aboutsummaryrefslogtreecommitdiff
path: root/common/stringop.c
diff options
context:
space:
mode:
authorIan Fan <ianfan0@gmail.com>2019-01-02 18:47:22 +0000
committerIan Fan <ianfan0@gmail.com>2019-01-02 18:47:22 +0000
commit5bef06adfdac4ce9940dcaf2d90a4bdffae7bba9 (patch)
tree1f9338e19afdae883b896e39eb997fb6eab77de8 /common/stringop.c
parentbd35879e1cfda51accc68c9890980dce59eb006a (diff)
fixup! stringop.c: rewrite strip_whitespace
Diffstat (limited to 'common/stringop.c')
-rw-r--r--common/stringop.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/common/stringop.c b/common/stringop.c
index f8b7aaec..8af0d60f 100644
--- a/common/stringop.c
+++ b/common/stringop.c
@@ -16,10 +16,10 @@ void strip_whitespace(char *str) {
size_t start = strspn(str, whitespace);
memmove(str, &str[start], len + 1 - start);
- if (!*str) return;
-
- for (len -= start + 1; isspace(str[len]); --len) {}
- str[len + 1] = '\0';
+ if (*str) {
+ for (len -= start + 1; isspace(str[len]); --len) {}
+ str[len + 1] = '\0';
+ }
}
void strip_quotes(char *str) {