aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2018-04-03 21:29:43 -0400
committerDrew DeVault <sir@cmpwn.com>2018-04-03 21:29:43 -0400
commitd48e7036aa04f8503737de678519cc389058b259 (patch)
tree4180ebb2da71f46af5c2bb07675e28a8f2b53fff
parent260595076977729bcaf9aadcfbbc8c5f269c6387 (diff)
Don't use asserts with side-effects
-rw-r--r--swaybar/bar.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/swaybar/bar.c b/swaybar/bar.c
index cf812a60..b617f9ab 100644
--- a/swaybar/bar.c
+++ b/swaybar/bar.c
@@ -299,7 +299,8 @@ void bar_setup(struct swaybar *bar,
bar->status = status_line_init(bar->config->status_command);
}
- assert(bar->display = wl_display_connect(NULL));
+ bar->display = wl_display_connect(NULL);
+ assert(bar->display);
struct wl_registry *registry = wl_display_get_registry(bar->display);
wl_registry_add_listener(registry, &registry_listener, bar);
@@ -317,14 +318,15 @@ void bar_setup(struct swaybar *bar,
}
}
- assert(pointer->cursor_theme = wl_cursor_theme_load(
- NULL, 16 * (max_scale * 2), bar->shm));
+ pointer->cursor_theme = wl_cursor_theme_load(
+ NULL, 16 * (max_scale * 2), bar->shm);
+ assert(pointer->cursor_theme);
struct wl_cursor *cursor;
- assert(cursor = wl_cursor_theme_get_cursor(
- pointer->cursor_theme, "left_ptr"));
+ cursor = wl_cursor_theme_get_cursor(pointer->cursor_theme, "left_ptr");
+ assert(cursor);
pointer->cursor_image = cursor->images[0];
- assert(pointer->cursor_surface =
- wl_compositor_create_surface(bar->compositor));
+ pointer->cursor_surface = wl_compositor_create_surface(bar->compositor);
+ assert(pointer->cursor_surface);
// TODO: we might not necessarily be meant to do all of the outputs
wl_list_for_each(output, &bar->outputs, link) {
@@ -334,8 +336,8 @@ void bar_setup(struct swaybar *bar,
continue;
}
output->name = strdup(coutput->name);
- assert(output->surface = wl_compositor_create_surface(
- bar->compositor));
+ output->surface = wl_compositor_create_surface(bar->compositor);
+ assert(output->surface);
output->layer_surface = zwlr_layer_shell_v1_get_layer_surface(
bar->layer_shell, output->surface, output->output,
ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM, "panel");