From d70ea033562ac8f72d580225db1945c03359437b Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Wed, 10 Jun 2009 19:59:36 +0200 Subject: [PATCH] Remove some dead code, add default paths to switch() to make static analyzers happy Check was done with scan-build from the LLVM suite. The remaining reports are false positives and have been reported to llvm: http://llvm.org/bugs/show_bug.cgi?id=4358 http://llvm.org/bugs/show_bug.cgi?id=4359 --- src/commands.c | 9 +++++++++ src/handlers.c | 11 +---------- src/layout.c | 3 --- src/util.c | 2 +- 4 files changed, 11 insertions(+), 14 deletions(-) diff --git a/src/commands.c b/src/commands.c index d1ee5c69..80b94ab9 100644 --- a/src/commands.c +++ b/src/commands.c @@ -239,6 +239,9 @@ static void move_current_window(xcb_connection_t *conn, direction_t direction) { new = CUR_TABLE[current_col][++current_row]; break; + /* To make static analyzers happy: */ + default: + return; } /* Remove it from the old container and put it into the new one */ @@ -312,6 +315,9 @@ static void move_current_container(xcb_connection_t *conn, direction_t direction new = CUR_TABLE[current_col][++current_row]; break; + /* To make static analyzers happy: */ + default: + return; } LOG("old = %d,%d and new = %d,%d\n", container->col, container->row, new->col, new->row); @@ -416,6 +422,9 @@ static void snap_current_container(xcb_connection_t *conn, direction_t direction container->rowspan++; break; } + /* To make static analyzers happy: */ + default: + return; } render_layout(conn); diff --git a/src/handlers.c b/src/handlers.c index 45cb37c1..010dcaa5 100644 --- a/src/handlers.c +++ b/src/handlers.c @@ -911,8 +911,7 @@ int handle_normal_hints(void *data, xcb_connection_t *conn, uint8_t state, xcb_w LOG("window is %08x / %s\n", client->child, client->name); - int base_width = 0, base_height = 0, - min_width = 0, min_height = 0; + int base_width = 0, base_height = 0; /* base_width/height are the desired size of the window. We check if either the program-specified size or the program-specified @@ -925,14 +924,6 @@ int handle_normal_hints(void *data, xcb_connection_t *conn, uint8_t state, xcb_w base_height = size_hints.min_height; } - if (size_hints.flags & XCB_SIZE_HINT_P_MIN_SIZE) { - min_width = size_hints.min_width; - min_height = size_hints.min_height; - } else if (size_hints.flags & XCB_SIZE_HINT_P_SIZE) { - min_width = size_hints.base_width; - min_height = size_hints.base_height; - } - double width = client->rect.width - base_width; double height = client->rect.height - base_height; /* Convert numerator/denominator to a double */ diff --git a/src/layout.c b/src/layout.c index 8b01471a..426dd027 100644 --- a/src/layout.c +++ b/src/layout.c @@ -336,9 +336,6 @@ void render_container(xcb_connection_t *conn, Container *container) { xcb_configure_window(conn, stack_win->window, mask, values); } - /* Reconfigure the currently focused client, if necessary. It is the only visible one */ - client = container->currently_focused; - /* Render the decorations of all clients */ CIRCLEQ_FOREACH(client, &(container->clients), clients) { /* If the client is in fullscreen mode, it does not get reconfigured */ diff --git a/src/util.c b/src/util.c index 40e39e84..c0268358 100644 --- a/src/util.c +++ b/src/util.c @@ -451,7 +451,7 @@ void switch_layout_mode(xcb_connection_t *conn, Container *container, int mode) Client *get_matching_client(xcb_connection_t *conn, const char *window_classtitle, Client *specific) { char *to_class, *to_title, *to_title_ucs = NULL; - int to_title_ucs_len; + int to_title_ucs_len = 0; Client *matching = NULL; to_class = sstrdup(window_classtitle); -- 2.39.5