From 0b878dd9d74e48881c3f9255d9b8ba98cc6cc217 Mon Sep 17 00:00:00 2001 From: Akos Horvath Date: Sun, 17 Sep 2023 15:36:28 +0200 Subject: [PATCH] remove unused variables and functions --- src/client.c | 3 --- src/config.c | 4 ---- src/handler.c | 26 +------------------------- src/handler.h | 2 -- src/util.c | 2 ++ src/util.h | 2 -- src/wm.c | 1 - 7 files changed, 3 insertions(+), 37 deletions(-) diff --git a/src/client.c b/src/client.c index aa379f0..1c6ee0b 100644 --- a/src/client.c +++ b/src/client.c @@ -59,7 +59,6 @@ ret: Client* wm_client_create(Wm *wm, Window w) { DEBUG_PRINT("%s\n", __func__); - Client *t; XTextProperty xtp; int strln; @@ -385,8 +384,6 @@ ret: Client* wm_client_get_focused(Wm *wm) { - Client *c = NULL; - Workspace *ws = &wm->smon->workspaces[wm->smon->selws]; TreeNode *node = wm_treenode_ptr_find_focused_client_node(ws->tree); diff --git a/src/config.c b/src/config.c index dc6d976..78bbdeb 100644 --- a/src/config.c +++ b/src/config.c @@ -121,7 +121,6 @@ void wm_configfile_init(ConfigFile *config, const char *filename) assert(filename); strncpy(config->file_path, filename, PATH_MAX); - const size_t size = CONFIG_ARGC_MAX*CONFIG_ARGLEN_MAX; ConfigCommand commands[] = { (ConfigCommand) {.string = "border_color", .arg_count = 1, @@ -176,7 +175,6 @@ void wm_configfile_read(ConfigFile *cfile, Config *config) const int max_line_len = 8192; char line[max_line_len]; - char argv[CONFIG_ARGC_MAX][CONFIG_ARGLEN_MAX]; size_t line_index = 0; ConfigCommand command = {0}; wm_configcommand_init(&command); @@ -201,8 +199,6 @@ void wm_configfile_read(ConfigFile *cfile, Config *config) void wm_config_apply_command(Config *config, ConfigCommand *command) { - void *arg = NULL; - switch (command->arg_type) { case TYPE_INTEGER: for (size_t i = 0; i < command->argc; i++) { diff --git a/src/handler.c b/src/handler.c index b9dda53..d201107 100644 --- a/src/handler.c +++ b/src/handler.c @@ -21,28 +21,6 @@ along with this program. If not, see . #include "wm.h" #include "client.h" -static int wm_xerror_handler(Wm *wm, Display *display, XErrorEvent *e) -{ - printf("wm: Error occured. id: %d req_code: %d\n", - e->error_code, e->request_code); - - char etext[200]; - XGetErrorText(wm->display, e->error_code, etext, 200); - - printf("%s\n", etext); - - if (e->error_code == BadAccess) { - wm->other_wm = true; - } - - return 0; -} - -static int wm_other_wm_handler(Display *display, XErrorEvent *e) -{ - return 0; -} - void wm_create_handler(Wm *wm, XCreateWindowEvent e) { DEBUG_PRINT("CreateNotify event\n"); @@ -73,7 +51,6 @@ void wm_keyrelease_handler(XKeyReleasedEvent e) void wm_keypress_handler(Wm *wm, XKeyPressedEvent e) { DEBUG_PRINT("KeyPressed event, code: %d\n", e.keycode) - Client *c; Keybind k; DEBUG_PRINT("wm->config.kb_count: %d\n", wm->config.kb_count); @@ -144,8 +121,7 @@ void wm_configure_handler(Wm *wm, XConfigureRequestEvent e) { DEBUG_PRINT("ConfigureRequest event\n"); - Client *c; - XWindowChanges wc; + XWindowChanges wc; wc.x = e.x; wc.y = e.y; diff --git a/src/handler.h b/src/handler.h index 4a5467e..543b578 100644 --- a/src/handler.h +++ b/src/handler.h @@ -30,8 +30,6 @@ along with this program. If not, see . #include #include "wm.h" -static int wm_xerror_handler(Wm *wm, Display *display, XErrorEvent *e); -static int wm_other_wm_handler(Display *display, XErrorEvent *e); void wm_create_handler(Wm *wm, XCreateWindowEvent e); void wm_destroy_handler(Wm *wm, XDestroyWindowEvent e); void wm_reparent_handler(XReparentEvent e); diff --git a/src/util.c b/src/util.c index c32f875..73d9a08 100644 --- a/src/util.c +++ b/src/util.c @@ -5,6 +5,8 @@ #include #include +static unsigned int node_id = 0; + TreeNode* wm_treenode_new(NodeType type, TreeNode *parent) { DEBUG_PRINT("%s\n", __func__); diff --git a/src/util.h b/src/util.h index dca13d9..c9a3a93 100644 --- a/src/util.h +++ b/src/util.h @@ -12,8 +12,6 @@ #define WM_HORIZ_TOP 0 #define WM_HORIZ_BOT 1 -static unsigned int node_id = 0; - typedef enum NodeType { NODE_VERTICAL, NODE_HORIZONTAL, diff --git a/src/wm.c b/src/wm.c index 13ad336..9cbb5f8 100644 --- a/src/wm.c +++ b/src/wm.c @@ -629,7 +629,6 @@ void wm_settings_message_parse(Wm *wm, char *c, int len) int op; /* 0 = set, 1 = get */ size_t i = 0; - char ret[50]; char *token; char tokens[20][50]; char *settings[] = {"border-width", "border-color", "focused-border-color",