Very minor issues found with statical analysis.
The Clang Static Analyzer uncovered those issues: - The variable "changed" in handlers.c is written to, but it's never read since that specific write, so the write is not necessary. - In util.c, "tail" may be NULL. In that case, we shouldn't pass it to strlen because strlen's behavior is not defined when s is NULL. - In util.c, "write_index" is incremented twice. It's never used anymore after being incremented once, so the second increment is not necessary.
This commit is contained in:
parent
9e08366082
commit
f4ec0bceff
|
@ -751,7 +751,6 @@ int handle_normal_hints(void *data, xcb_connection_t *conn, uint8_t state, xcb_w
|
||||||
con->base_height = base_height;
|
con->base_height = base_height;
|
||||||
DLOG("client's base_height changed to %d\n", base_height);
|
DLOG("client's base_height changed to %d\n", base_height);
|
||||||
DLOG("client's base_width changed to %d\n", base_width);
|
DLOG("client's base_width changed to %d\n", base_width);
|
||||||
changed = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If no aspect ratio was set or if it was invalid, we ignore the hints */
|
/* If no aspect ratio was set or if it was invalid, we ignore the hints */
|
||||||
|
|
|
@ -199,7 +199,8 @@ char *resolve_tilde(const char *path) {
|
||||||
head = globbuf.gl_pathv[0];
|
head = globbuf.gl_pathv[0];
|
||||||
result = scalloc(strlen(head) + (tail ? strlen(tail) : 0) + 1);
|
result = scalloc(strlen(head) + (tail ? strlen(tail) : 0) + 1);
|
||||||
strncpy(result, head, strlen(head));
|
strncpy(result, head, strlen(head));
|
||||||
strncat(result, tail, strlen(tail));
|
if (tail)
|
||||||
|
strncat(result, tail, strlen(tail));
|
||||||
}
|
}
|
||||||
globfree(&globbuf);
|
globfree(&globbuf);
|
||||||
|
|
||||||
|
@ -353,7 +354,7 @@ void i3_restart(bool forget_layout) {
|
||||||
|
|
||||||
/* add the arguments we'll replace */
|
/* add the arguments we'll replace */
|
||||||
new_argv[write_index++] = "--restart";
|
new_argv[write_index++] = "--restart";
|
||||||
new_argv[write_index++] = restart_filename;
|
new_argv[write_index] = restart_filename;
|
||||||
|
|
||||||
/* swap the argvs */
|
/* swap the argvs */
|
||||||
start_argv = new_argv;
|
start_argv = new_argv;
|
||||||
|
|
Loading…
Reference in New Issue