swaybar: Use "!ptr" for comparison to NULL

Signed-off-by: Elyes HAOUAS <ehaouas@noos.fr>
This commit is contained in:
Elyes HAOUAS 2021-04-13 10:33:35 +02:00
parent a6d761a31c
commit c71a8b0b7b
4 changed files with 6 additions and 6 deletions

View file

@ -13,7 +13,7 @@
#include "swaybar/status_line.h" #include "swaybar/status_line.h"
void i3bar_block_unref(struct i3bar_block *block) { void i3bar_block_unref(struct i3bar_block *block) {
if (block == NULL) { if (!block) {
return; return;
} }

View file

@ -298,7 +298,7 @@ static void wl_pointer_frame(void *data, struct wl_pointer *wl_pointer) {
struct swaybar_pointer *pointer = &seat->pointer; struct swaybar_pointer *pointer = &seat->pointer;
struct swaybar_output *output = pointer->current; struct swaybar_output *output = pointer->current;
if (output == NULL) { if (!output) {
return; return;
} }
@ -473,7 +473,7 @@ static void seat_handle_capabilities(void *data, struct wl_seat *wl_seat,
if (!have_pointer && seat->pointer.pointer != NULL) { if (!have_pointer && seat->pointer.pointer != NULL) {
wl_pointer_release(seat->pointer.pointer); wl_pointer_release(seat->pointer.pointer);
seat->pointer.pointer = NULL; 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); seat->pointer.pointer = wl_seat_get_pointer(wl_seat);
if (seat->bar->running && !seat->pointer.cursor_surface) { if (seat->bar->running && !seat->pointer.cursor_surface) {
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) { if (!have_touch && seat->touch.touch != NULL) {
wl_touch_release(seat->touch.touch); wl_touch_release(seat->touch.touch);
seat->touch.touch = NULL; 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); seat->touch.touch = wl_seat_get_touch(wl_seat);
wl_touch_add_listener(seat->touch.touch, &touch_listener, seat); wl_touch_add_listener(seat->touch.touch, &touch_listener, seat);
} }

View file

@ -51,7 +51,7 @@ bool status_handle_readable(struct status_line *status) {
status->buffer_size = available_bytes + 1; status->buffer_size = available_bytes + 1;
status->buffer = realloc(status->buffer, status->buffer_size); 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"); sway_log_errno(SWAY_ERROR, "Unable to read status line");
status_error(status, "[error reading from status command]"); status_error(status, "[error reading from status command]");
return true; return true;

View file

@ -386,7 +386,7 @@ void init_themes(list_t **themes, list_t **basedirs) {
*themes = create_list(); *themes = create_list();
for (int i = 0; i < (*basedirs)->length; ++i) { for (int i = 0; i < (*basedirs)->length; ++i) {
list_t *dir_themes = load_themes_in_dir((*basedirs)->items[i]); list_t *dir_themes = load_themes_in_dir((*basedirs)->items[i]);
if (dir_themes == NULL) { if (!dir_themes) {
continue; continue;
} }
list_cat(*themes, dir_themes); list_cat(*themes, dir_themes);