aboutsummaryrefslogtreecommitdiffstats
path: root/sway/tree/root.c
diff options
context:
space:
mode:
authorLibravatar M Stoeckl <code@mstoeckl.com>2019-01-22 10:07:38 -0500
committerLibravatar M Stoeckl <code@mstoeckl.com>2019-01-22 10:12:04 -0500
commit0af5b26e41c5141d4094652133c230d76bf82e56 (patch)
tree75c61907f094838e23899231ec5ec955c530f692 /sway/tree/root.c
parentMerge pull request #3494 from ianyfan/commands (diff)
downloadsway-0af5b26e41c5141d4094652133c230d76bf82e56.tar.gz
sway-0af5b26e41c5141d4094652133c230d76bf82e56.tar.zst
sway-0af5b26e41c5141d4094652133c230d76bf82e56.zip
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.
Diffstat (limited to 'sway/tree/root.c')
-rw-r--r--sway/tree/root.c9
1 files changed, 4 insertions, 5 deletions
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) {
169 pid_t parent = -1; 169 pid_t parent = -1;
170 char file_name[100]; 170 char file_name[100];
171 char *buffer = NULL; 171 char *buffer = NULL;
172 char *token = NULL;
173 const char *sep = " "; 172 const char *sep = " ";
174 FILE *stat = NULL; 173 FILE *stat = NULL;
175 size_t buf_size = 0; 174 size_t buf_size = 0;
@@ -178,10 +177,10 @@ static pid_t get_parent_pid(pid_t child) {
178 177
179 if ((stat = fopen(file_name, "r"))) { 178 if ((stat = fopen(file_name, "r"))) {
180 if (getline(&buffer, &buf_size, stat) != -1) { 179 if (getline(&buffer, &buf_size, stat) != -1) {
181 token = strtok(buffer, sep); // pid 180 strtok(buffer, sep); // pid
182 token = strtok(NULL, sep); // executable name 181 strtok(NULL, sep); // executable name
183 token = strtok(NULL, sep); // state 182 strtok(NULL, sep); // state
184 token = strtok(NULL, sep); // parent pid 183 char *token = strtok(NULL, sep); // parent pid
185 parent = strtol(token, NULL, 10); 184 parent = strtol(token, NULL, 10);
186 } 185 }
187 free(buffer); 186 free(buffer);