summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2006-12-23 15:00:16 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2006-12-23 15:00:16 +0000
commitaed67bfc398e8058fde9953f58edea9a3831557b (patch)
treeede4fa97b64226be66962e789807a815f6a6b68d /sys
parent2aa3fc49bf3fa7021cecebd48b0c41a192494318 (diff)
When compiling with gcc3, flag pool_get() as a malloc-like function, this
helps optimization. With feedback from grange@ and thib@, ok deraadt@
Diffstat (limited to 'sys')
-rw-r--r--sys/sys/cdefs.h8
-rw-r--r--sys/sys/pool.h4
2 files changed, 9 insertions, 3 deletions
diff --git a/sys/sys/cdefs.h b/sys/sys/cdefs.h
index 9ff58846991..65446a6c5d3 100644
--- a/sys/sys/cdefs.h
+++ b/sys/sys/cdefs.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cdefs.h,v 1.23 2006/04/17 16:36:43 cloder Exp $ */
+/* $OpenBSD: cdefs.h,v 1.24 2006/12/23 15:00:14 miod Exp $ */
/* $NetBSD: cdefs.h,v 1.16 1996/04/03 20:46:39 christos Exp $ */
/*
@@ -189,6 +189,12 @@
#define __statement(x) (x)
#endif
+#if __GNUC_PREREQ__(3, 0)
+#define __malloc __attribute__((__malloc__))
+#else
+#define __malloc
+#endif
+
/*
* "The nice thing about standards is that there are so many to choose from."
* There are a number of "feature test macros" specified by (different)
diff --git a/sys/sys/pool.h b/sys/sys/pool.h
index ac8d7def45b..727a9e0be67 100644
--- a/sys/sys/pool.h
+++ b/sys/sys/pool.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: pool.h,v 1.19 2006/05/07 20:06:50 tedu Exp $ */
+/* $OpenBSD: pool.h,v 1.20 2006/12/23 15:00:15 miod Exp $ */
/* $NetBSD: pool.h,v 1.27 2001/06/06 22:00:17 rafal Exp $ */
/*-
@@ -197,7 +197,7 @@ void pool_init(struct pool *, size_t, u_int, u_int, int,
const char *, struct pool_allocator *);
void pool_destroy(struct pool *);
-void *pool_get(struct pool *, int);
+void *pool_get(struct pool *, int) __malloc;
void pool_put(struct pool *, void *);
int pool_reclaim(struct pool *);