summaryrefslogtreecommitdiff
path: root/dwmblocks.c
diff options
context:
space:
mode:
Diffstat (limited to 'dwmblocks.c')
-rw-r--r--dwmblocks.c12
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)
Software created with 💖