Skip to content

Commit

Permalink
cmd: Do not use comparison to NULL
Browse files Browse the repository at this point in the history
checkpatch emits two warnings of type:

    CHECK: Comparison to NULL could be written "!foo"

Prefer `(!foo)` instead of `(foo == NULL)`.

Do not use comparison to NULL, use !foo

Signed-off-by: Tobin C. Harding <me@tobin.cc>
  • Loading branch information
tcharding committed Aug 17, 2018
1 parent 2115d56 commit 5518659
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/lxc/cmd/lxc_monitord.c
Expand Up @@ -208,7 +208,7 @@ static int lxc_monitord_sock_accept(int fd, uint32_t events, void *data,

clientfds = realloc(mon->clientfds,
(mon->clientfds_size + CLIENTFDS_CHUNK) * sizeof(mon->clientfds[0]));
if (clientfds == NULL) {
if (!clientfds) {
ERROR("Failed to realloc memory for %d client file descriptors",
mon->clientfds_size + CLIENTFDS_CHUNK);
goto err1;
Expand Down
2 changes: 1 addition & 1 deletion src/lxc/cmd/lxc_user_nic.c
Expand Up @@ -752,7 +752,7 @@ static char *get_nic_if_avail(int fd, struct alloted_s *names, int pid,
lxc_strmunmap(buf, sb.st_size);
}

if (owner == NULL)
if (!owner)
return NULL;

ret = snprintf(nicname, sizeof(nicname), "vethXXXXXX");
Expand Down

0 comments on commit 5518659

Please sign in to comment.