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 | |
parent | reset errno so previous error doesn't cause next check to fail (diff) | |
parent | Merge pull request #75 from Murtaught/master (diff) | |
download | dwmblocks-681b8998c25dadd2673c7fb7218a43df3921b48f.tar.gz dwmblocks-681b8998c25dadd2673c7fb7218a43df3921b48f.tar.bz2 dwmblocks-681b8998c25dadd2673c7fb7218a43df3921b48f.tar.xz dwmblocks-681b8998c25dadd2673c7fb7218a43df3921b48f.tar.zst dwmblocks-681b8998c25dadd2673c7fb7218a43df3921b48f.zip |
Merge branch 'master' into fastscroll_fix
using pulled version of fix to remove_all bug (with an improvement)
-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) |