From 648ae00ee4ab56da09a82e07aa04b61b756abfdc Mon Sep 17 00:00:00 2001 From: buffet Date: Tue, 6 Nov 2018 18:21:55 +0100 Subject: [PATCH] Refactored, because muh dryness --- src/kiwmi/ipc.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/kiwmi/ipc.c b/src/kiwmi/ipc.c index 6241a18..8471b9f 100644 --- a/src/kiwmi/ipc.c +++ b/src/kiwmi/ipc.c @@ -20,8 +20,6 @@ #include "common.h" -#define STREQ(a, b) (strcmp((a), (b)) == 0) - int g_sock_fd; void @@ -56,16 +54,18 @@ init_socket(void) } } +#define CMDIS(c) (strcmp(command, (c)) == 0) + void handle_ipc_event(char *msg) { char *command = strtok(msg, " "); - if (STREQ(command, "quit")) { + if (CMDIS("quit")) { g_is_about_to_quit = true; - } else if (STREQ(command, "reload")) { + } else if (CMDIS("reload")) { exec_config(); - } else if (STREQ(command, "exec")) { + } else if (CMDIS("exec")) { char *command = strtok(NULL, ""); execl("/bin/sh", "/bin/sh", "-c", command, NULL); g_is_about_to_quit = true;