From 244d60de2f16840afea17519a7b13b04c16f6acd Mon Sep 17 00:00:00 2001 From: Pablo Neira Ayuso Date: Wed, 20 Aug 2014 14:51:12 +0200 Subject: utils: define xfree() as macro Original description from Thomas Petazzoni: When ELF binaries and shared libraries are used, the internal functions of libnftnl such as xfree() are not visible to the outside world (their visibility is 'hidden'). Therefore, the fact that other programs (especially nftables) may have symbols with the same name does not cause any problem. However, when doing static linking on a non-ELF platform (such as Blackfin, which uses the FLAT binary format), there is no way of encoding this visibility. Therefore, the xfree() symbols of libnftnl becomes visible to the outside world, causing a conflict with the xfree() symbol defined by nftables. To solve this, this patch convers xfree as a macro instead of a function. Reported-by: Thomas Petazzoni Signed-off-by: Pablo Neira Ayuso --- src/utils.c | 5 ----- 1 file changed, 5 deletions(-) (limited to 'src/utils.c') diff --git a/src/utils.c b/src/utils.c index 1878390..96c8bf2 100644 --- a/src/utils.c +++ b/src/utils.c @@ -180,11 +180,6 @@ int nft_str2verdict(const char *verdict, int *verdict_num) return -1; } -void xfree(const void *ptr) -{ - free((void *)ptr); -} - int nft_fprintf(FILE *fp, void *obj, uint32_t type, uint32_t flags, int (*snprintf_cb)(char *buf, size_t bufsiz, void *obj, uint32_t type, uint32_t flags)) -- cgit v1.2.3