aboutsummaryrefslogtreecommitdiff
path: root/sway/tree
diff options
context:
space:
mode:
authorM Stoeckl <code@mstoeckl.com>2019-01-22 10:07:38 -0500
committerM Stoeckl <code@mstoeckl.com>2019-01-22 10:12:04 -0500
commit0af5b26e41c5141d4094652133c230d76bf82e56 (patch)
tree75c61907f094838e23899231ec5ec955c530f692 /sway/tree
parent71a37ad186ba3080338b2ecb5a3e640600aefc1f (diff)
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.c9
-rw-r--r--sway/tree/view.c4
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) {
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);
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) {
con->border_bottom = bottom_y != ws->y + ws->height;
}
- double x, y, width, height;
- x = y = width = height = 0;
double y_offset = 0;
// 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) {
con->border_top = false;
}
+ double x, y, width, height;
switch (con->border) {
+ default:
case B_CSD:
case B_NONE:
x = con->x;