From c71a8b0b7bbc33094f880aeb9d9888ec3c4c4327 Mon Sep 17 00:00:00 2001 From: Elyes HAOUAS Date: Tue, 13 Apr 2021 10:33:35 +0200 Subject: [PATCH] swaybar: Use "!ptr" for comparison to NULL Signed-off-by: Elyes HAOUAS --- swaybar/i3bar.c | 2 +- swaybar/input.c | 6 +++--- swaybar/status_line.c | 2 +- swaybar/tray/icon.c | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/swaybar/i3bar.c b/swaybar/i3bar.c index 4bcd58431..c8954073e 100644 --- a/swaybar/i3bar.c +++ b/swaybar/i3bar.c @@ -13,7 +13,7 @@ #include "swaybar/status_line.h" void i3bar_block_unref(struct i3bar_block *block) { - if (block == NULL) { + if (!block) { return; } diff --git a/swaybar/input.c b/swaybar/input.c index 6e13f1773..4a06a08d0 100644 --- a/swaybar/input.c +++ b/swaybar/input.c @@ -298,7 +298,7 @@ static void wl_pointer_frame(void *data, struct wl_pointer *wl_pointer) { struct swaybar_pointer *pointer = &seat->pointer; struct swaybar_output *output = pointer->current; - if (output == NULL) { + if (!output) { return; } @@ -473,7 +473,7 @@ static void seat_handle_capabilities(void *data, struct wl_seat *wl_seat, if (!have_pointer && seat->pointer.pointer != NULL) { wl_pointer_release(seat->pointer.pointer); seat->pointer.pointer = NULL; - } else if (have_pointer && seat->pointer.pointer == NULL) { + } else if (have_pointer && !seat->pointer.pointer) { seat->pointer.pointer = wl_seat_get_pointer(wl_seat); if (seat->bar->running && !seat->pointer.cursor_surface) { seat->pointer.cursor_surface = @@ -485,7 +485,7 @@ static void seat_handle_capabilities(void *data, struct wl_seat *wl_seat, if (!have_touch && seat->touch.touch != NULL) { wl_touch_release(seat->touch.touch); seat->touch.touch = NULL; - } else if (have_touch && seat->touch.touch == NULL) { + } else if (have_touch && !seat->touch.touch) { seat->touch.touch = wl_seat_get_touch(wl_seat); wl_touch_add_listener(seat->touch.touch, &touch_listener, seat); } diff --git a/swaybar/status_line.c b/swaybar/status_line.c index ecd91032a..d5b624fc0 100644 --- a/swaybar/status_line.c +++ b/swaybar/status_line.c @@ -51,7 +51,7 @@ bool status_handle_readable(struct status_line *status) { status->buffer_size = available_bytes + 1; status->buffer = realloc(status->buffer, status->buffer_size); } - if (status->buffer == NULL) { + if (!status->buffer) { sway_log_errno(SWAY_ERROR, "Unable to read status line"); status_error(status, "[error reading from status command]"); return true; diff --git a/swaybar/tray/icon.c b/swaybar/tray/icon.c index c426c3d4a..c4744131b 100644 --- a/swaybar/tray/icon.c +++ b/swaybar/tray/icon.c @@ -386,7 +386,7 @@ void init_themes(list_t **themes, list_t **basedirs) { *themes = create_list(); for (int i = 0; i < (*basedirs)->length; ++i) { list_t *dir_themes = load_themes_in_dir((*basedirs)->items[i]); - if (dir_themes == NULL) { + if (!dir_themes) { continue; } list_cat(*themes, dir_themes);