diff options
author | M Stoeckl <code@mstoeckl.com> | 2019-01-22 10:07:38 -0500 |
---|---|---|
committer | M Stoeckl <code@mstoeckl.com> | 2019-01-22 10:12:04 -0500 |
commit | 0af5b26e41c5141d4094652133c230d76bf82e56 (patch) | |
tree | 75c61907f094838e23899231ec5ec955c530f692 /sway/tree | |
parent | Merge pull request #3494 from ianyfan/commands (diff) | |
download | sway-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')
-rw-r--r-- | sway/tree/root.c | 9 | ||||
-rw-r--r-- | sway/tree/view.c | 4 |
2 files changed, 6 insertions, 7 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); |
diff --git a/sway/tree/view.c b/sway/tree/view.c index edbfca97..8795e04f 100644 --- a/sway/tree/view.c +++ b/sway/tree/view.c | |||
@@ -236,8 +236,6 @@ void view_autoconfigure(struct sway_view *view) { | |||
236 | con->border_bottom = bottom_y != ws->y + ws->height; | 236 | con->border_bottom = bottom_y != ws->y + ws->height; |
237 | } | 237 | } |
238 | 238 | ||
239 | double x, y, width, height; | ||
240 | x = y = width = height = 0; | ||
241 | double y_offset = 0; | 239 | double y_offset = 0; |
242 | 240 | ||
243 | // In a tabbed or stacked container, the container's y is the top of the | 241 | // In a tabbed or stacked container, the container's y is the top of the |
@@ -253,7 +251,9 @@ void view_autoconfigure(struct sway_view *view) { | |||
253 | con->border_top = false; | 251 | con->border_top = false; |
254 | } | 252 | } |
255 | 253 | ||
254 | double x, y, width, height; | ||
256 | switch (con->border) { | 255 | switch (con->border) { |
256 | default: | ||
257 | case B_CSD: | 257 | case B_CSD: |
258 | case B_NONE: | 258 | case B_NONE: |
259 | x = con->x; | 259 | x = con->x; |