From a6ba3ad626ccd15f9104b3143c297f39cce6e050 Mon Sep 17 00:00:00 2001 From: Pablo Neira Ayuso Date: Tue, 22 Aug 2017 18:19:12 +0200 Subject: src: remove ifdef DEBUG pollution Get rid of lots of ifdef DEBUG pollution in the code. The --debug= option is useful to get feedback from users, so it should be always there. And we really save nothing from keeping this code away from the control plane with a compile time option. Just running tests/shell/ before and after this patch, time shows almost no difference. So this patch leaves --enable-debug around to add debugging symbols in your builds, this is left set on by default. Signed-off-by: Pablo Neira Ayuso --- src/netlink.c | 14 -------------- 1 file changed, 14 deletions(-) (limited to 'src/netlink.c') diff --git a/src/netlink.c b/src/netlink.c index f6eb08fd..7730b724 100644 --- a/src/netlink.c +++ b/src/netlink.c @@ -504,7 +504,6 @@ int netlink_del_rule_batch(struct netlink_ctx *ctx, const struct handle *h, void netlink_dump_rule(const struct nftnl_rule *nlr) { -#ifdef DEBUG char buf[4096]; if (!(debug_level & DEBUG_NETLINK)) @@ -512,12 +511,10 @@ void netlink_dump_rule(const struct nftnl_rule *nlr) nftnl_rule_snprintf(buf, sizeof(buf), nlr, 0, 0); fprintf(stdout, "%s\n", buf); -#endif } void netlink_dump_expr(const struct nftnl_expr *nle) { -#ifdef DEBUG char buf[4096]; if (!(debug_level & DEBUG_NETLINK)) @@ -525,7 +522,6 @@ void netlink_dump_expr(const struct nftnl_expr *nle) nftnl_expr_snprintf(buf, sizeof(buf), nle, 0, 0); fprintf(stdout, "%s\n", buf); -#endif } static int list_rule_cb(struct nftnl_rule *nlr, void *arg) @@ -579,7 +575,6 @@ static int netlink_flush_rules(struct netlink_ctx *ctx, const struct handle *h, void netlink_dump_chain(const struct nftnl_chain *nlc) { -#ifdef DEBUG char buf[4096]; if (!(debug_level & DEBUG_NETLINK)) @@ -587,7 +582,6 @@ void netlink_dump_chain(const struct nftnl_chain *nlc) nftnl_chain_snprintf(buf, sizeof(buf), nlc, 0, 0); fprintf(stdout, "%s\n", buf); -#endif } static int netlink_add_chain_compat(struct netlink_ctx *ctx, @@ -1036,7 +1030,6 @@ static const struct datatype *dtype_map_from_kernel(enum nft_data_types type) void netlink_dump_set(const struct nftnl_set *nls) { -#ifdef DEBUG char buf[4096]; if (!(debug_level & DEBUG_NETLINK)) @@ -1044,7 +1037,6 @@ void netlink_dump_set(const struct nftnl_set *nls) nftnl_set_snprintf(buf, sizeof(buf), nls, 0, 0); fprintf(stdout, "%s\n", buf); -#endif } static int set_parse_udata_cb(const struct nftnl_udata *attr, void *data) @@ -1661,7 +1653,6 @@ out: void netlink_dump_obj(struct nftnl_obj *nln) { -#ifdef DEBUG char buf[4096]; if (!(debug_level & DEBUG_NETLINK)) @@ -1669,7 +1660,6 @@ void netlink_dump_obj(struct nftnl_obj *nln) nftnl_obj_snprintf(buf, sizeof(buf), nln, 0, 0); fprintf(stdout, "%s\n", buf); -#endif } int netlink_add_obj(struct netlink_ctx *ctx, const struct handle *h, @@ -2854,7 +2844,6 @@ static int netlink_events_trace_cb(const struct nlmsghdr *nlh, int type, return MNL_CB_OK; } -#ifdef DEBUG /* only those which could be useful listening to events */ static const char *const nftnl_msg_types[NFT_MSG_MAX] = { [NFT_MSG_NEWTABLE] = "NFT_MSG_NEWTABLE", @@ -2880,16 +2869,13 @@ static const char *nftnl_msgtype2str(uint16_t type) return nftnl_msg_types[type]; } -#endif /* DEBUG */ static void netlink_events_debug(uint16_t type) { -#ifdef DEBUG if (!(debug_level & DEBUG_NETLINK)) return; printf("netlink event: %s\n", nftnl_msgtype2str(type)); -#endif /* DEBUG */ } static int netlink_events_newgen_cb(const struct nlmsghdr *nlh, int type, -- cgit v1.2.3