summaryrefslogtreecommitdiffstats
path: root/sys/contrib/ipfilter/netinet/ip_compat.h
diff options
context:
space:
mode:
authordes <des@FreeBSD.org>2008-10-23 15:53:51 +0000
committerdes <des@FreeBSD.org>2008-10-23 15:53:51 +0000
commit66f807ed8b3634dc73d9f7526c484e43f094c0ee (patch)
tree21e792ce590e1bcf9b343890605a1b4c6a9016b3 /sys/contrib/ipfilter/netinet/ip_compat.h
parenta779c60ce0a41cd14710a8a12cfa22955108b27a (diff)
downloadFreeBSD-src-66f807ed8b3634dc73d9f7526c484e43f094c0ee.zip
FreeBSD-src-66f807ed8b3634dc73d9f7526c484e43f094c0ee.tar.gz
Retire the MALLOC and FREE macros. They are an abomination unto style(9).
MFC after: 3 months
Diffstat (limited to 'sys/contrib/ipfilter/netinet/ip_compat.h')
-rw-r--r--sys/contrib/ipfilter/netinet/ip_compat.h21
1 files changed, 16 insertions, 5 deletions
diff --git a/sys/contrib/ipfilter/netinet/ip_compat.h b/sys/contrib/ipfilter/netinet/ip_compat.h
index 6f05720..31e5b11 100644
--- a/sys/contrib/ipfilter/netinet/ip_compat.h
+++ b/sys/contrib/ipfilter/netinet/ip_compat.h
@@ -1662,12 +1662,23 @@ MALLOC_DECLARE(M_IPFILTER);
# endif /* M_IPFILTER */
# endif /* M_PFIL */
# endif /* IPFILTER_M_IPFILTER */
-# define KMALLOC(a, b) MALLOC((a), b, sizeof(*(a)), _M_IPF, M_NOWAIT)
-# if !defined(KMALLOCS)
-# define KMALLOCS(a, b, c) MALLOC((a), b, (c), _M_IPF, M_NOWAIT)
+# if defined(__FreeBSD__) && __FreeBSD_version >= 800051
+# define KMALLOC(a, b) do { \
+ a = (b)malloc(sizeof(*(a)), _M_IPF, M_NOWAIT); \
+ } while (0)
+# define KMALLOCS(a, b, c) do { \
+ a = (b)malloc((c), _M_IPF, ((c) > 4096) ? M_WAITOK : M_NOWAIT); \
+ } while (0)
+# define KFREE(x) free((x), _M_IPF)
+# define KFREES(x,s) free((x), _M_IPF)
+# else
+# define KMALLOC(a, b) MALLOC((a), b, sizeof(*(a)), _M_IPF, M_NOWAIT)
+# if !defined(KMALLOCS)
+# define KMALLOCS(a, b, c) MALLOC((a), b, (c), _M_IPF, M_NOWAIT)
+# endif
+# define KFREE(x) FREE((x), _M_IPF)
+# define KFREES(x,s) FREE((x), _M_IPF)
# endif
-# define KFREE(x) FREE((x), _M_IPF)
-# define KFREES(x,s) FREE((x), _M_IPF)
# define UIOMOVE(a,b,c,d) uiomove((caddr_t)a,b,d)
# define SLEEP(id, n) tsleep((id), PPAUSE|PCATCH, n, 0)
# define WAKEUP(id,x) wakeup(id+x)
OpenPOWER on IntegriCloud