diff options
author | dfuehrer <dfuehrer@email.arizona.edu> | 2021-06-01 20:54:26 -0700 |
---|---|---|
committer | dfuehrer <dfuehrer@email.arizona.edu> | 2021-06-01 20:54:26 -0700 |
commit | 681b8998c25dadd2673c7fb7218a43df3921b48f (patch) | |
tree | 76a1f5ca2b20d0d9db9f07b87261e3e6dedd8e1e /dwmblocks.c | |
parent | fc80bd975c264959a73e074bc2ff49c52c384ac3 (diff) | |
parent | ea5afdccbd23d61e70f3ef62aabd9b6726b2c20f (diff) |
Merge branch 'master' into fastscroll_fix
using pulled version of fix to remove_all bug (with an improvement)
Diffstat (limited to 'dwmblocks.c')
-rw-r--r-- | dwmblocks.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/dwmblocks.c b/dwmblocks.c index 0a0644f..d4cc1a4 100644 --- a/dwmblocks.c +++ b/dwmblocks.c @@ -53,11 +53,13 @@ void replace(char *str, char old, char new) void remove_all(char *str, char to_remove) { char *read = str; char *write = str; - do { - while (*read == to_remove) read++; - *write++ = *read; - read++; - } while (*(read-1)); + while (*read) { + if (*read != to_remove) { + *write++ = *read; + } + ++read; + } + *write = '\0'; } int gcd(int a, int b) |