mirror of
https://github.com/swaywm/sway.git
synced 2026-04-23 06:46:27 -04:00
common: Use "!ptr" for comparison to NULL
Signed-off-by: Elyes HAOUAS <ehaouas@noos.fr>
This commit is contained in:
parent
8106f01c17
commit
c66fb38bf8
3 changed files with 4 additions and 4 deletions
|
|
@ -23,7 +23,7 @@ static void list_resize(list_t *list) {
|
|||
}
|
||||
|
||||
void list_free(list_t *list) {
|
||||
if (list == NULL) {
|
||||
if (!list) {
|
||||
return;
|
||||
}
|
||||
free(list->items);
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ void get_text_size(cairo_t *cairo, const char *font, int *width, int *height,
|
|||
va_end(args);
|
||||
|
||||
char *buf = malloc(length);
|
||||
if (buf == NULL) {
|
||||
if (!buf) {
|
||||
sway_log(SWAY_ERROR, "Failed to allocate memory");
|
||||
return;
|
||||
}
|
||||
|
|
@ -118,7 +118,7 @@ void pango_printf(cairo_t *cairo, const char *font,
|
|||
va_end(args);
|
||||
|
||||
char *buf = malloc(length);
|
||||
if (buf == NULL) {
|
||||
if (!buf) {
|
||||
sway_log(SWAY_ERROR, "Failed to allocate memory");
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -319,7 +319,7 @@ bool expand_path(char **path) {
|
|||
memmove(ptr + 1, ptr, strlen(ptr) + 1);
|
||||
*ptr = '\\';
|
||||
}
|
||||
if (wordexp(*path, &p, 0) != 0 || p.we_wordv[0] == NULL) {
|
||||
if (wordexp(*path, &p, 0) != 0 || !p.we_wordv[0]) {
|
||||
wordfree(&p);
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue