]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
cmd: Do not use comparison to NULL 2540/head
authorTobin C. Harding <me@tobin.cc>
Fri, 17 Aug 2018 06:18:27 +0000 (16:18 +1000)
committerTobin C. Harding <me@tobin.cc>
Fri, 17 Aug 2018 06:18:27 +0000 (16:18 +1000)
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>
src/lxc/cmd/lxc_monitord.c
src/lxc/cmd/lxc_user_nic.c

index 4194bb6380ebfbe1304678abdc35221d3b4c9ccb..e6cb77338c9e6a6f741a1665874bb2f040006ceb 100644 (file)
@@ -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;
index 2f35d7a40c4bc0285bee870025309a10e4d74465..09b158245385222566ac70b8c781ecb235b4f9a6 100644 (file)
@@ -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");