Fix d_printf() compile error.

This commit is contained in:
Tomofumi Hayashi 2015-04-28 17:22:46 +09:00
parent af3ac20395
commit a39365279c
2 changed files with 12 additions and 12 deletions

View File

@ -40,7 +40,7 @@
#include "nftnlrdr_misc.h" #include "nftnlrdr_misc.h"
#ifdef DEBUG #ifdef DEBUG
#define d_printf(x) {printf x;} #define d_printf(x) do { printf x; } while (0)
#else #else
#define d_printf(x) #define d_printf(x)
#endif #endif
@ -65,8 +65,8 @@ add_redirect_rule2(const char * ifname,
{ {
struct nft_rule *r; struct nft_rule *r;
UNUSED(timestamp); UNUSED(timestamp);
d_printf("add redirect rule2(%s, %s, %u, %s, %u, %d, %s)!\n", d_printf(("add redirect rule2(%s, %s, %u, %s, %u, %d, %s)!\n",
ifname, rhost, eport, iaddr, iport, proto, desc); ifname, rhost, eport, iaddr, iport, proto, desc));
r = rule_set_dnat(NFPROTO_IPV4, ifname, proto, r = rule_set_dnat(NFPROTO_IPV4, ifname, proto,
0, eport, 0, eport,
inet_addr(iaddr), iport, desc, NULL); inet_addr(iaddr), iport, desc, NULL);
@ -89,7 +89,7 @@ add_peer_redirect_rule2(const char * ifname,
struct nft_rule *r; struct nft_rule *r;
UNUSED(ifname); UNUSED(timestamp); 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, r = rule_set_snat(NFPROTO_IPV4, proto,
inet_addr(rhost), rport, inet_addr(rhost), rport,
inet_addr(eaddr), eport, inet_addr(eaddr), eport,
@ -113,8 +113,8 @@ add_filter_rule2(const char * ifname,
struct nft_rule *r = NULL; struct nft_rule *r = NULL;
in_addr_t rhost_addr = 0; in_addr_t rhost_addr = 0;
d_printf("add_filter_rule2(%s, %s, %s, %d, %d, %d, %s)\n", d_printf(("add_filter_rule2(%s, %s, %s, %d, %d, %d, %s)\n",
ifname, rhost, iaddr, eport, iport, proto, desc); ifname, rhost, iaddr, eport, iport, proto, desc));
if (rhost != NULL && strcmp(rhost, "") != 0) { if (rhost != NULL && strcmp(rhost, "") != 0) {
rhost_addr = inet_addr(rhost); rhost_addr = inet_addr(rhost);
} }
@ -154,7 +154,7 @@ delete_redirect_and_filter_rules(unsigned short eport, int proto)
uint16_t iport = 0; uint16_t iport = 0;
extern void print_rule(rule_t *r) ; 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); reflesh_nft_cache(NFPROTO_IPV4);
LIST_FOREACH(p, &head, entry) { LIST_FOREACH(p, &head, entry) {
if (p->eport == eport && p->proto == proto && if (p->eport == eport && p->proto == proto &&
@ -205,7 +205,7 @@ get_peer_rule_by_index(int index,
rule_t *r; rule_t *r;
UNUSED(timestamp); UNUSED(packets); UNUSED(bytes); 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); reflesh_nft_cache(NFPROTO_IPV4);
if (peer_cache == NULL) { if (peer_cache == NULL) {
return -1; return -1;
@ -291,7 +291,7 @@ get_redirect_rule_by_index(int index,
rule_t *r; rule_t *r;
UNUSED(timestamp); UNUSED(packets); UNUSED(bytes); 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); reflesh_nft_cache(NFPROTO_IPV4);
if (redirect_cache == NULL) { if (redirect_cache == NULL) {
return -1; return -1;
@ -358,7 +358,7 @@ get_nat_redirect_rule(const char * nat_chain_name, const char * ifname,
UNUSED(packets); UNUSED(packets);
UNUSED(bytes); UNUSED(bytes);
d_printf("get_nat_redirect_rule()\n"); d_printf(("get_nat_redirect_rule()\n"));
reflesh_nft_cache(NFPROTO_IPV4); reflesh_nft_cache(NFPROTO_IPV4);
LIST_FOREACH(p, &head, entry) { LIST_FOREACH(p, &head, entry) {
@ -394,7 +394,7 @@ get_portmappings_in_range(unsigned short startport, unsigned short endport,
unsigned short *array; unsigned short *array;
unsigned short *tmp; unsigned short *tmp;
d_printf("get_portmappings_in_range()\n"); d_printf(("get_portmappings_in_range()\n"));
*number = 0; *number = 0;
capacity = 128; capacity = 128;
array = calloc(capacity, sizeof(unsigned short)); array = calloc(capacity, sizeof(unsigned short));

View File

@ -37,7 +37,7 @@
#include "../upnpglobalvars.h" #include "../upnpglobalvars.h"
#ifdef DEBUG #ifdef DEBUG
#define d_printf(x) {printf x;} #define d_printf(x) do { printf x; } while (0)
#else #else
#define d_printf(x) #define d_printf(x)
#endif #endif