commit 4746824

wf  ·  2026-05-05 10:49:20 +0000 UTC
parent 28ddd6f
Normalize bracketless statement indents
3 files changed,  +28, -14
+2, -1
 1@@ -126,7 +126,8 @@ ipc_msg(const struct command *cmd, int argc, char **argv) {
 2 			ret = 0;
 3 		}
 4 
 5-		while (*msg2 == ' ') msg2++;
 6+		while (*msg2 == ' ')
 7+			msg2++;
 8 
 9 		if (strcmp(msg2, "") != 0)
10 			printf("%s", msg2);
+21, -11
  1@@ -265,7 +265,8 @@ setup(void) {
  2 		_err(1, "couldn't initialize swc");
  3 
  4 	const char *sock = wl_display_add_socket_auto(wm.dpy);
  5-	if (!sock) _err(1, "couldn't add Wayland display socket");
  6+	if (!sock)
  7+		_err(1, "couldn't add Wayland display socket");
  8 
  9 	setenv("WAYLAND_DISPLAY", sock, 1);
 10 	_inf("set WAYLAND_DISPLAY=%s", sock);
 11@@ -353,10 +354,12 @@ title_format(struct client *target, char *fmt) {
 12 		char c = fmt[i];
 13 
 14 		if (c == '%') {
 15-			if (oi + 1 < MAXSIZE) buf[oi++] = '%';
 16+			if (oi + 1 < MAXSIZE)
 17+				buf[oi++] = '%';
 18 		} else if (c == 't' || c == 'a') {
 19 			const char *t = (c == 't') ? target->win->title : target->win->app_id;
 20-			if (!t) continue;
 21+			if (!t)
 22+				continue;
 23 			while (*t && oi + 1 < MAXSIZE)
 24 				buf[oi++] = *t++;
 25 		} else if (c == 'p') {
 26@@ -410,7 +413,7 @@ decorate(struct client *c, bool focus) {
 27 			.enabled = decor->enabled,
 28 			.edge = decor->edge,
 29 			.align = decor->align,
 30-			.string = title, /* TODO: title formatting */
 31+			.string = title,
 32 			.color = decor->foreground,
 33 			.padding = decor->padding,
 34 			.offset_x = decor->offset_x,
 35@@ -456,7 +459,8 @@ first_client(struct screen *s) {
 36 	struct client *c;
 37 
 38 	wl_list_for_each(c, &wm.clients, link) {
 39-		if (is_ws_client(c, s)) return c;
 40+		if (is_ws_client(c, s))
 41+			return c;
 42 	}
 43 
 44 	return NULL;
 45@@ -505,7 +509,8 @@ void
 46 ws_move_to(uint8_t ws) {
 47 	struct client *c, *next;
 48 
 49-	if (!wm.cur || ws < 1 || ws > 9) return;
 50+	if (!wm.cur || ws < 1 || ws > 9)
 51+		return;
 52 	c = wm.cur;
 53 	if (c->ws == ws)
 54 		return;
 55@@ -530,7 +535,8 @@ focus_prev(void) {
 56 	struct client *c = NULL;
 57 	if (!wm.cur || !is_ws_client(wm.cur, wm.scr)) {
 58 		c = first_client(wm.scr);
 59-		if (!c) c = first_client(NULL);
 60+		if (!c)
 61+			c = first_client(NULL);
 62 		focus(c);
 63 		return;
 64 	}
 65@@ -566,7 +572,8 @@ focus_next(void) {
 66 	struct client *c = NULL;
 67 	if (!wm.cur || !is_ws_client(wm.cur, wm.scr)) {
 68 		c = first_client(wm.scr);
 69-		if (!c) c = first_client(NULL);
 70+		if (!c)
 71+			c = first_client(NULL);
 72 		focus(c);
 73 		return;
 74 	}
 75@@ -608,7 +615,8 @@ new_screen(struct swc_screen *scr) {
 76 	s->height = scr->usable_geometry.height;
 77 
 78 	wl_list_insert(&wm.screens, &s->link);
 79-	if (!wm.scr) wm.scr = s;
 80+	if (!wm.scr)
 81+		wm.scr = s;
 82 	swc_screen_set_handler(scr, &scr_handler, s);
 83 	_inf("new_screen=%p", (void *)scr);
 84 }
 85@@ -654,7 +662,8 @@ new_window(struct swc_window *win) {
 86 
 87 static void
 88 on_win_entered(void *data) {
 89-	if (wm.grab.active) return;
 90+	if (wm.grab.active)
 91+		return;
 92 
 93 	struct client *c = data;
 94 	if (!is_ws_client(c, NULL))
 95@@ -678,7 +687,8 @@ on_win_destroy(void *data) {
 96 	free(c);
 97 
 98 	next = first_client(wm.scr);
 99-	if (!next) next = first_client(NULL);
100+	if (!next)
101+		next = first_client(NULL);
102 	focus(next);
103 }
104 
+5, -2
 1@@ -30,7 +30,8 @@ fn_uint(char *s) {
 2 
 3 static uint32_t
 4 fn_hex(char *s) {
 5-	if (s[0] == '#') s++;
 6+	if (s[0] == '#')
 7+		s++;
 8 	return strtoul(s, NULL, 16);
 9 }
10 
11@@ -432,8 +433,10 @@ ipc_bind(char **arg) {
12 
13 	struct bind tmp = fn_bind(arg[1]);
14 	int count = 0;
15-	for (char **p = arg + 2; *p != NULL; p++) count++;
16+	for (char **p = arg + 2; *p != NULL; p++)
17+		count++;
18 
19+	/* XXX: where is this freed? */
20 	char **cmd = malloc((count + 1) * sizeof(char*));
21 	if (!cmd)
22 		return (status){ false, "" };