From a39365279ca7b689d58aaa49ed6559b203a2b8df Mon Sep 17 00:00:00 2001 From: Tomofumi Hayashi Date: Tue, 28 Apr 2015 17:22:46 +0900 Subject: [PATCH] Fix d_printf() compile error. --- miniupnpd/netfilter_nft/nftnlrdr.c | 22 +++++++++++----------- miniupnpd/netfilter_nft/nftnlrdr_misc.c | 2 +- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/miniupnpd/netfilter_nft/nftnlrdr.c b/miniupnpd/netfilter_nft/nftnlrdr.c index 235c31f..9866de2 100644 --- a/miniupnpd/netfilter_nft/nftnlrdr.c +++ b/miniupnpd/netfilter_nft/nftnlrdr.c @@ -40,7 +40,7 @@ #include "nftnlrdr_misc.h" #ifdef DEBUG -#define d_printf(x) {printf x;} +#define d_printf(x) do { printf x; } while (0) #else #define d_printf(x) #endif @@ -65,8 +65,8 @@ add_redirect_rule2(const char * ifname, { struct nft_rule *r; UNUSED(timestamp); - d_printf("add redirect rule2(%s, %s, %u, %s, %u, %d, %s)!\n", - ifname, rhost, eport, iaddr, iport, proto, desc); + d_printf(("add redirect rule2(%s, %s, %u, %s, %u, %d, %s)!\n", + ifname, rhost, eport, iaddr, iport, proto, desc)); r = rule_set_dnat(NFPROTO_IPV4, ifname, proto, 0, eport, inet_addr(iaddr), iport, desc, NULL); @@ -89,7 +89,7 @@ add_peer_redirect_rule2(const char * ifname, struct nft_rule *r; UNUSED(ifname); UNUSED(timestamp); - d_printf("add peer redirect rule2()!\n"); + d_printf(("add peer redirect rule2()!\n")); r = rule_set_snat(NFPROTO_IPV4, proto, inet_addr(rhost), rport, inet_addr(eaddr), eport, @@ -113,8 +113,8 @@ add_filter_rule2(const char * ifname, struct nft_rule *r = NULL; in_addr_t rhost_addr = 0; - d_printf("add_filter_rule2(%s, %s, %s, %d, %d, %d, %s)\n", - ifname, rhost, iaddr, eport, iport, proto, desc); + d_printf(("add_filter_rule2(%s, %s, %s, %d, %d, %d, %s)\n", + ifname, rhost, iaddr, eport, iport, proto, desc)); if (rhost != NULL && strcmp(rhost, "") != 0) { rhost_addr = inet_addr(rhost); } @@ -154,7 +154,7 @@ delete_redirect_and_filter_rules(unsigned short eport, int proto) uint16_t iport = 0; extern void print_rule(rule_t *r) ; - d_printf("delete_redirect_and_filter_rules(%d %d)\n", eport, proto); + d_printf(("delete_redirect_and_filter_rules(%d %d)\n", eport, proto)); reflesh_nft_cache(NFPROTO_IPV4); LIST_FOREACH(p, &head, entry) { if (p->eport == eport && p->proto == proto && @@ -205,7 +205,7 @@ get_peer_rule_by_index(int index, rule_t *r; UNUSED(timestamp); UNUSED(packets); UNUSED(bytes); - d_printf("get_peer_rule_by_index()\n"); + d_printf(("get_peer_rule_by_index()\n")); reflesh_nft_cache(NFPROTO_IPV4); if (peer_cache == NULL) { return -1; @@ -291,7 +291,7 @@ get_redirect_rule_by_index(int index, rule_t *r; UNUSED(timestamp); UNUSED(packets); UNUSED(bytes); - d_printf("get_redirect_rule_by_index()\n"); + d_printf(("get_redirect_rule_by_index()\n")); reflesh_nft_cache(NFPROTO_IPV4); if (redirect_cache == NULL) { return -1; @@ -358,7 +358,7 @@ get_nat_redirect_rule(const char * nat_chain_name, const char * ifname, UNUSED(packets); UNUSED(bytes); - d_printf("get_nat_redirect_rule()\n"); + d_printf(("get_nat_redirect_rule()\n")); reflesh_nft_cache(NFPROTO_IPV4); LIST_FOREACH(p, &head, entry) { @@ -394,7 +394,7 @@ get_portmappings_in_range(unsigned short startport, unsigned short endport, unsigned short *array; unsigned short *tmp; - d_printf("get_portmappings_in_range()\n"); + d_printf(("get_portmappings_in_range()\n")); *number = 0; capacity = 128; array = calloc(capacity, sizeof(unsigned short)); diff --git a/miniupnpd/netfilter_nft/nftnlrdr_misc.c b/miniupnpd/netfilter_nft/nftnlrdr_misc.c index ac13ac2..a35c45e 100644 --- a/miniupnpd/netfilter_nft/nftnlrdr_misc.c +++ b/miniupnpd/netfilter_nft/nftnlrdr_misc.c @@ -37,7 +37,7 @@ #include "../upnpglobalvars.h" #ifdef DEBUG -#define d_printf(x) {printf x;} +#define d_printf(x) do { printf x; } while (0) #else #define d_printf(x) #endif