summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@gmail.com>2012-01-08 21:19:43 -0500
committerUlrich Drepper <drepper@gmail.com>2012-01-08 21:19:43 -0500
commitec09c1c410d40386ec3e5d2d82fc5c378b4b2681 (patch)
tree2189714f7efcfc502ddef885c7c1d541eae6684c /include
parentaebae0537dcb408100b88c6b7647a7e858c43237 (diff)
Optimize xmalloc, xcalloc, xrealloc, and xstrdup
Add alloc_size attribute and apply consistently the malloc attribute to xmalloc, xcalloc, xrealloc, and xstrdup.
Diffstat (limited to 'include')
-rw-r--r--include/sys/cdefs.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/sys/cdefs.h b/include/sys/cdefs.h
index cd0750b452..a2bdf20d93 100644
--- a/include/sys/cdefs.h
+++ b/include/sys/cdefs.h
@@ -12,4 +12,11 @@ extern void __chk_fail (void) __attribute__ ((__noreturn__));
libc_hidden_proto (__chk_fail)
rtld_hidden_proto (__chk_fail)
+
+#if __GNUC_PREREQ (4,3)
+# define __attribute_alloc_size(...) __attribute__ ((alloc_size (__VA_ARGS__)))
+#else
+# define __attribute_alloc_size(...)
+#endif
+
#endif