From: Tobin C. Harding Date: Fri, 17 Aug 2018 06:18:27 +0000 (+1000) Subject: cmd: Do not use comparison to NULL X-Git-Tag: lxc-3.1.0~155^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=551865932ee6c5e70d310d56d89ddc5bee6b0348;p=thirdparty%2Flxc.git 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 --- 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");