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
This commit is contained in:
Michael Stapelberg 2009-06-10 19:59:36 +02:00
parent 2f334c3f59
commit d70ea03356
4 changed files with 11 additions and 14 deletions

View File

@ -239,6 +239,9 @@ static void move_current_window(xcb_connection_t *conn, direction_t direction) {
new = CUR_TABLE[current_col][++current_row]; new = CUR_TABLE[current_col][++current_row];
break; break;
/* To make static analyzers happy: */
default:
return;
} }
/* Remove it from the old container and put it into the new one */ /* 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]; new = CUR_TABLE[current_col][++current_row];
break; 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); 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++; container->rowspan++;
break; break;
} }
/* To make static analyzers happy: */
default:
return;
} }
render_layout(conn); render_layout(conn);

View File

@ -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); LOG("window is %08x / %s\n", client->child, client->name);
int base_width = 0, base_height = 0, int base_width = 0, base_height = 0;
min_width = 0, min_height = 0;
/* base_width/height are the desired size of the window. /* base_width/height are the desired size of the window.
We check if either the program-specified size or the program-specified 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; 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 width = client->rect.width - base_width;
double height = client->rect.height - base_height; double height = client->rect.height - base_height;
/* Convert numerator/denominator to a double */ /* Convert numerator/denominator to a double */

View File

@ -336,9 +336,6 @@ void render_container(xcb_connection_t *conn, Container *container) {
xcb_configure_window(conn, stack_win->window, mask, values); 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 */ /* Render the decorations of all clients */
CIRCLEQ_FOREACH(client, &(container->clients), clients) { CIRCLEQ_FOREACH(client, &(container->clients), clients) {
/* If the client is in fullscreen mode, it does not get reconfigured */ /* If the client is in fullscreen mode, it does not get reconfigured */

View File

@ -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 *get_matching_client(xcb_connection_t *conn, const char *window_classtitle,
Client *specific) { Client *specific) {
char *to_class, *to_title, *to_title_ucs = NULL; char *to_class, *to_title, *to_title_ucs = NULL;
int to_title_ucs_len; int to_title_ucs_len = 0;
Client *matching = NULL; Client *matching = NULL;
to_class = sstrdup(window_classtitle); to_class = sstrdup(window_classtitle);