commit b438599
wf
·
2026-04-06 14:04:48 +0000 UTC
parent 26f8fbb
Fix symbol bug and clean up
M
client.c
+1,
-1
1@@ -103,7 +103,7 @@ main(int argc, char **argv) {
2 return 1;
3 }
4
5- for (int i = 0; i < (sizeof commands / sizeof commands[0]); i++) {
6+ for (int i = 0; i < (int)(sizeof commands / sizeof commands[0]); i++) {
7 if (strcmp(commands[i].name, argv[1]) == 0) {
8 if (commands[i].argc != argc - 2) {
9 fprintf(stderr, "Wrong number of arguments for %s (need %d)\n", commands[i].name, commands[i].argc);
M
howl.c
+16,
-17
1@@ -21,7 +21,6 @@ static void on_win_destroy(void *);
2 static void on_win_entered(void *);
3 static void on_scr_destroy(void *);
4 static bool is_ws_client(const struct client *, const struct screen *);
5-static void sig_handler(int);
6
7 extern void ipc_move(char **);
8 extern void ipc_move_absolute(char **);
9@@ -43,8 +42,8 @@ extern void ipc_bind(char **);
10 extern void ipc_quit(char **);
11 extern void ipc_config(char **);
12
13-static struct wm wm;
14-static struct config config;
15+struct wm wm;
16+struct config config;
17
18 static struct swc_manager mgr = {
19 .new_screen = &new_screen,
20@@ -178,14 +177,21 @@ setup_ipc(void) {
21 _inf("set up IPC socket");
22 }
23
24+static void
25+sig_handler(int s) {
26+ UNUSED(s);
27+ _wrn("caught deadly signal, exiting!");
28+ if (wm.dpy) {
29+ swc_finalize();
30+ wl_display_terminate(wm.dpy);
31+ }
32+}
33+
34 static void
35 setup(void) {
36- char *conf_path = malloc(MAXSIZE * sizeof(char));
37 wm.dpy = wl_display_create();
38 if (!wm.dpy) _err(1, "couldn't create Wayland display");
39
40- conf_path[0] = '\0';
41-
42 wl_list_init(&wm.screens);
43 wl_list_init(&wm.clients);
44 wm.cur = NULL;
45@@ -220,15 +226,6 @@ setup(void) {
46 signal(SIGQUIT, sig_handler);
47 }
48
49-static void
50-sig_handler(int s) {
51- _wrn("caught deadly signal, exiting!");
52- if (wm.dpy) {
53- swc_finalize();
54- wl_display_terminate(wm.dpy);
55- }
56-}
57-
58 void
59 cleanup(void) {
60 wl_display_terminate(wm.dpy);
61@@ -443,7 +440,7 @@ on_scr_destroy(void *data) {
62
63 int
64 main(int argc, char **argv) {
65- bool have_config;
66+ bool have_config = true;
67 char *conf_path = malloc(MAXSIZE * sizeof(char));
68 conf_path[0] = '\0';
69
70@@ -459,7 +456,7 @@ main(int argc, char **argv) {
71 return 0;
72 break;
73 case 'c':
74- snprintf(conf_path, sizeof conf_path, "%s", optarg);
75+ snprintf(conf_path, MAXSIZE * sizeof(char), "%s", optarg);
76 break;
77 case '?':
78 fprintf(stderr, "Unknown option: -%c", optopt);
79@@ -497,5 +494,7 @@ main(int argc, char **argv) {
80
81 wl_display_run(wm.dpy);
82 cleanup();
83+
84+ free(conf_path);
85 return 1;
86 }
M
ipc.c
+2,
-11
1@@ -9,8 +9,8 @@
2 #include "types.h"
3 #include "ipc.h"
4
5-static struct wm wm;
6-static struct config config;
7+extern struct wm wm;
8+extern struct config config;
9
10 struct bind {
11 uint32_t mod, key;
12@@ -21,11 +21,6 @@ fn_int(char *s) {
13 return atoi(s);
14 }
15
16-static uint32_t
17-fn_uint(char *s) {
18- return strtoul(s, NULL, 10);
19-}
20-
21 static uint32_t
22 fn_hex(char *s) {
23 if (s[0] == '#') s++;
24@@ -270,10 +265,6 @@ ipc_get_app_id(char **arg) {
25
26 void
27 ipc_bind(char **arg) {
28- /*
29- * NOTE: here arg[2] is not the full command, but rather the first token, which
30- * is still the minimum amount, but i thought it would be confusing without this note
31- */
32 if (arg[1] == NULL || arg[2] == NULL) return;
33
34 struct bind tmp = fn_bind(arg[1]);