]> The Tcpdump Group git mirrors - tcpdump/commitdiff
BOOTP: Move macro define/undef outsite functions
authorFrancois-Xavier Le Bail <[email protected]>
Thu, 4 Jan 2018 16:09:41 +0000 (17:09 +0100)
committerFrancois-Xavier Le Bail <[email protected]>
Thu, 4 Jan 2018 16:20:19 +0000 (17:20 +0100)
This avoid some Coccinelle warnings:
CPP-DEFINE: inside function, I treat it as comment
CPP-UNDEF: inside function, I treat it as comment

This also makes the code a bit clearer.

print-bootp.c

index e5e6bcafaa224da6e5b4a479aed8f17a6732e672..92577eaf64f6db3a3e653af896f4eb6be69fc891 100644 (file)
@@ -1061,6 +1061,10 @@ trunc:
        ND_PRINT((ndo, "|[rfc1048]"));
 }
 
+#define PRINTCMUADDR(m, s) { ND_TCHECK(cmu->m); \
+    if (cmu->m.s_addr != 0) \
+       ND_PRINT((ndo, " %s:%s", s, ipaddr_string(ndo, &cmu->m.s_addr))); }
+
 static void
 cmu_print(netdissect_options *ndo,
          const u_char *bp)
@@ -1068,10 +1072,6 @@ cmu_print(netdissect_options *ndo,
        const struct cmu_vend *cmu;
        uint8_t v_flags;
 
-#define PRINTCMUADDR(m, s) { ND_TCHECK(cmu->m); \
-    if (cmu->m.s_addr != 0) \
-       ND_PRINT((ndo, " %s:%s", s, ipaddr_string(ndo, &cmu->m.s_addr))); }
-
        ND_PRINT((ndo, " vend-cmu"));
        cmu = (const struct cmu_vend *)bp;
 
@@ -1092,9 +1092,10 @@ cmu_print(netdissect_options *ndo,
 
 trunc:
        ND_PRINT((ndo, "%s", tstr));
-#undef PRINTCMUADDR
 }
 
+#undef PRINTCMUADDR
+
 static char *
 client_fqdn_flags(u_int flags)
 {