aboutsummaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorLibravatar Ian Fan <ianfan0@gmail.com>2019-01-02 18:47:22 +0000
committerLibravatar Ian Fan <ianfan0@gmail.com>2019-01-02 18:47:22 +0000
commit5bef06adfdac4ce9940dcaf2d90a4bdffae7bba9 (patch)
tree1f9338e19afdae883b896e39eb997fb6eab77de8 /common
parentfixup! config.c: re-enable backslash continuation in config file (diff)
downloadsway-5bef06adfdac4ce9940dcaf2d90a4bdffae7bba9.tar.gz
sway-5bef06adfdac4ce9940dcaf2d90a4bdffae7bba9.tar.zst
sway-5bef06adfdac4ce9940dcaf2d90a4bdffae7bba9.zip
fixup! stringop.c: rewrite strip_whitespace
Diffstat (limited to 'common')
-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) {
16 size_t start = strspn(str, whitespace); 16 size_t start = strspn(str, whitespace);
17 memmove(str, &str[start], len + 1 - start); 17 memmove(str, &str[start], len + 1 - start);
18 18
19 if (!*str) return; 19 if (*str) {
20 20 for (len -= start + 1; isspace(str[len]); --len) {}
21 for (len -= start + 1; isspace(str[len]); --len) {} 21 str[len + 1] = '\0';
22 str[len + 1] = '\0'; 22 }
23} 23}
24 24
25void strip_quotes(char *str) { 25void strip_quotes(char *str) {