From 551865932ee6c5e70d310d56d89ddc5bee6b0348 Mon Sep 17 00:00:00 2001 From: "Tobin C. Harding" Date: Fri, 17 Aug 2018 16:18:27 +1000 Subject: [PATCH] cmd: Do not use comparison to NULL 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 --- src/lxc/cmd/lxc_monitord.c | 2 +- src/lxc/cmd/lxc_user_nic.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lxc/cmd/lxc_monitord.c b/src/lxc/cmd/lxc_monitord.c index 4194bb638..e6cb77338 100644 --- a/src/lxc/cmd/lxc_monitord.c +++ b/src/lxc/cmd/lxc_monitord.c @@ -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; diff --git a/src/lxc/cmd/lxc_user_nic.c b/src/lxc/cmd/lxc_user_nic.c index 2f35d7a40..09b158245 100644 --- a/src/lxc/cmd/lxc_user_nic.c +++ b/src/lxc/cmd/lxc_user_nic.c @@ -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"); -- 2.47.2