]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
Consolidate DEBUGP macros
authorPhil Sutter <phil@nwl.cc>
Thu, 2 Aug 2018 15:05:15 +0000 (17:05 +0200)
committerFlorian Westphal <fw@strlen.de>
Sat, 4 Aug 2018 12:24:54 +0000 (14:24 +0200)
This debug printing macro was defined in various places, always
identical. Move it into xshared.h and drop it from sources including
that header. There are a few exceptions:

* iptables-xml.c did not include xshared.h, which this patch changes.

* Sources in extensions and libiptc mostly left alone since they don't
  include xshared.h (and maybe shouldn't). Only libxt_set.h does, so
  it's converted, too.

This also converts DEBUG define use in libip6t_hbh.c to avoid a compiler
warning.

Signed-off-by: Phil Sutter <phil@nwl.cc>
Signed-off-by: Florian Westphal <fw@strlen.de>
extensions/libip6t_hbh.c
extensions/libxt_set.h
iptables/ip6tables-restore.c
iptables/iptables-restore.c
iptables/iptables-xml.c
iptables/nft-shared.h
iptables/xshared.h
iptables/xtables-restore.c

index 76b4ff00d4c054f4aabcfbd6db9cbf12a5261207..4cebecfd3d2f5e6fa8a76e92f0b30000e9163266 100644 (file)
@@ -5,8 +5,6 @@
 #include <xtables.h>
 #include <linux/netfilter_ipv6/ip6t_opts.h>
 
-#define DEBUG          0
-
 enum {
        O_HBH_LEN = 0,
        O_HBH_OPTS,
@@ -83,7 +81,7 @@ parse_options(const char *optsstr, uint16_t *opts)
                         opts[i] |= (0x00FF);
                }
 
-#if DEBUG
+#ifdef DEBUG
                printf("opts str: %s %s\n", cp, range);
                printf("opts opt: %04X\n", opts[i]);
 #endif
@@ -92,7 +90,7 @@ parse_options(const char *optsstr, uint16_t *opts)
 
        free(buffer);
 
-#if DEBUG
+#ifdef DEBUG
        printf("addr nr: %d\n", i);
 #endif
 
index 5a1bdcf730cf218078e82f6b0a27d97c08cfeb77..41dfbd30fc7c1fb5f5604a572d8e9ba725555ff3 100644 (file)
@@ -8,12 +8,6 @@
 #include <errno.h>
 #include "../iptables/xshared.h"
 
-#ifdef DEBUG
-#define DEBUGP(x, args...) fprintf(stderr, x , ## args)
-#else
-#define DEBUGP(x, args...) 
-#endif
-
 static int
 get_version(unsigned *version)
 {
index d36f92da45e181efa562dd86999884bdfc07f91d..3065768ed8e6bccc04da1f18bdbed60d18f0609e 100644 (file)
 #include "libiptc/libip6tc.h"
 #include "ip6tables-multi.h"
 
-#ifdef DEBUG
-#define DEBUGP(x, args...) fprintf(stderr, x, ## args)
-#else
-#define DEBUGP(x, args...)
-#endif
-
 static int counters, verbose, noflush, wait;
 
 static struct timeval wait_interval = {
index 142ddb825ce6dde9489a29ef24b59462e13016cb..e52e8e47dda7485c8b84ebaab50147f24fad32cc 100644 (file)
 #include "libiptc/libiptc.h"
 #include "iptables-multi.h"
 
-#ifdef DEBUG
-#define DEBUGP(x, args...) fprintf(stderr, x, ## args)
-#else
-#define DEBUGP(x, args...)
-#endif
-
 static int counters, verbose, noflush, wait;
 
 static struct timeval wait_interval = {
index 69c19a60180f2226d8abcef74942e0b9472f2d3a..a1b09f3ad745c45cacfea0cdb3c99e91ddbe4b9a 100644 (file)
 #include "libiptc/libiptc.h"
 #include "xtables-multi.h"
 #include <xtables.h>
-
-#ifdef DEBUG
-#define DEBUGP(x, args...) fprintf(stderr, x, ## args)
-#else
-#define DEBUGP(x, args...)
-#endif
+#include "xshared.h"
 
 struct xtables_globals iptables_xml_globals = {
        .option_offset = 0,
index 882f60e868c09c8fa56e9f33879bf8f9e8fa804d..5ef17a088a208c8bddc0634befc0310e9a2c35fd 100644 (file)
 
 #include "xshared.h"
 
-#if 0
-#define DEBUGP(x, args...) fprintf(stdout, x, ## args)
+#ifdef DEBUG
 #define NLDEBUG
 #define DEBUG_DEL
-#else
-#define DEBUGP(x, args...)
 #endif
 
 /*
index 533c52686bc292ac2f77f4a3fe67343fdf7515dc..363549db78894008289ceee2e21745a81f9b43b4 100644 (file)
 #include <linux/netfilter_ipv4/ip_tables.h>
 #include <linux/netfilter_ipv6/ip6_tables.h>
 
+#ifdef DEBUG
+#define DEBUGP(x, args...) fprintf(stdout, x, ## args)
+#else
+#define DEBUGP(x, args...)
+#endif
+
 enum {
        OPT_NONE        = 0,
        OPT_NUMERIC     = 1 << 0,
index 5c0ae98e8821a49bfb2d5eb5239e4cca1d79e44d..0a3d1a311678239da382d295ec8f0ba1454c04b4 100644 (file)
 #include "nft-bridge.h"
 #include <libnftnl/chain.h>
 
-#ifdef DEBUG
-#define DEBUGP(x, args...) fprintf(stderr, x, ## args)
-#else
-#define DEBUGP(x, args...)
-#endif
-
 static int counters, verbose, noflush;
 
 /* Keeping track of external matches and targets.  */