]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Clean up version test.
authorGuy Harris <[email protected]>
Fri, 25 Mar 2016 19:51:08 +0000 (12:51 -0700)
committerGuy Harris <[email protected]>
Fri, 25 Mar 2016 19:51:08 +0000 (12:51 -0700)
!(nfhdr->nflog_version) is equivalent to (nfhdr->nflog_version == 0).

That will evaluate to 1 if nfhdr->nflog_version is 0 and to 0 otherwise.

So !(nfhdr->nflog_version) == 0 is equivalent to nfhdr->nflog_version != 0,
but 1) it's more obvious what it means and 2) compilers don't point out
that it may not mean what you intended.

print-nflog.c

index 2a42f537c78da879cf204235ba72cebf4af95b45..0eefd342a45c7b1035005f0c1b58b583c1b61d26 100644 (file)
@@ -80,7 +80,7 @@ nflog_if_print(netdissect_options *ndo,
                return h_size;
        }
 
-       if (!(hdr->nflog_version) == 0) {
+       if (hdr->nflog_version != 0) {
                ND_PRINT((ndo, "version %u (unknown)", hdr->nflog_version));
                return h_size;
        }