commit 1ee9d60

wf  ·  2026-05-18 15:33:42 +0000 UTC
parent c64bf1b
Clean up decor.c, remove trailing space
2 files changed,  +5, -6
+4, -5
 1@@ -15,8 +15,6 @@
 2 #include "howl.h"
 3 #include "types.h"
 4 
 5-#define CLEAN(x) if (x[strlen(x) - 1] == ',' || x[strlen(x) - 1] == '\n') x[strlen(x) - 1] = '\0'
 6-
 7 extern struct wm wm;
 8 extern struct decor *decor;
 9 
10@@ -131,17 +129,18 @@ load_decor(char *path) {
11 				*sep = '\0';
12 				char *key = line;
13 				char *val = sep + 1;
14-				CLEAN(key);
15 
16+				if (key[strlen(key) - 1] == ',' || key[strlen(key) - 1] == '\n')
17+					key[strlen(key) - 1] = '\0';
18 				while (key[0] && isspace((unsigned char)key[strlen(key) - 1]))
19 					key[strlen(key) - 1] = '\0';
20 				while (*key && isspace((unsigned char)*key))
21 					key++;
22 
23-				while (*val && isspace((unsigned char)*val))
24+				while (*val && (isspace((unsigned char)*val) || *val == '"'))
25 					val++;
26 				size_t vlen = strlen(val);
27-				while (vlen > 0 && isspace((unsigned char)val[vlen - 1]))
28+				while (vlen > 0 && (isspace((unsigned char)val[vlen - 1]) || val[vlen - 1] == '"'))
29 					val[--vlen] = '\0';
30 
31 				if (strcmp(key, "left") == 0)
+1, -1
1@@ -326,7 +326,7 @@ ipc_get_geometry(char **arg) {
2 
3 	struct swc_rectangle geom;
4 	if (swc_window_get_geometry(c->win, &geom)) {
5-		snprintf(s.msg, sizeof(s.msg), "%d %d %" PRIu32 " %" PRIu32 "\n", geom.x, geom.y, geom.width, geom.height);  
6+		snprintf(s.msg, sizeof(s.msg), "%d %d %" PRIu32 " %" PRIu32 "\n", geom.x, geom.y, geom.width, geom.height);
7 	}
8 
9 	s.ok = true;