From 0af5b26e41c5141d4094652133c230d76bf82e56 Mon Sep 17 00:00:00 2001 From: M Stoeckl Date: Tue, 22 Jan 2019 10:07:38 -0500 Subject: Fix dead stores found by scan-build In addition to removing unused code, two minor problems are fixed: (1) `resize set` and `resize adjust` did not error when given too many arguments. (2) `orientation` was incorrectly overridden to be 'U' for scroll events in the swaybar tray `handle_click` function. --- sway/tree/root.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'sway/tree/root.c') diff --git a/sway/tree/root.c b/sway/tree/root.c index c4d1145d..99cf91a7 100644 --- a/sway/tree/root.c +++ b/sway/tree/root.c @@ -169,7 +169,6 @@ static pid_t get_parent_pid(pid_t child) { pid_t parent = -1; char file_name[100]; char *buffer = NULL; - char *token = NULL; const char *sep = " "; FILE *stat = NULL; size_t buf_size = 0; @@ -178,10 +177,10 @@ static pid_t get_parent_pid(pid_t child) { if ((stat = fopen(file_name, "r"))) { if (getline(&buffer, &buf_size, stat) != -1) { - token = strtok(buffer, sep); // pid - token = strtok(NULL, sep); // executable name - token = strtok(NULL, sep); // state - token = strtok(NULL, sep); // parent pid + strtok(buffer, sep); // pid + strtok(NULL, sep); // executable name + strtok(NULL, sep); // state + char *token = strtok(NULL, sep); // parent pid parent = strtol(token, NULL, 10); } free(buffer); -- cgit v1.2.3