summaryrefslogtreecommitdiff
path: root/util.h
diff options
context:
space:
mode:
authorTobias Klauser <tklauser@distanz.ch>2015-04-08 09:31:14 +0200
committerTobias Klauser <tklauser@distanz.ch>2015-04-08 09:31:14 +0200
commit772e430d840a6479da87d4cd701d42695476c52e (patch)
tree8425ba27a4b5a3a41a13358748bf84fdded2377e /util.h
parentcd53a2b488f4107e48a80eb336e2b1001591246a (diff)
util: Add attribute warn_unused_result to allocation functions
Add the warn_unused_result GCC function attribute to all allocation functions in xmalloc. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Diffstat (limited to 'util.h')
-rw-r--r--util.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/util.h b/util.h
index d4933c4..0c3d263 100644
--- a/util.h
+++ b/util.h
@@ -58,10 +58,10 @@ static inline void __noreturn panic(const char *fmt, ...)
exit(EXIT_FAILURE);
}
-void *xmalloc(size_t size);
-void *xzalloc(size_t size);
-void *xrealloc(void *ptr, size_t size);
-char *xstrdup(const char *s);
+void *xmalloc(size_t size) __warn_unused_result;
+void *xzalloc(size_t size) __warn_unused_result;
+void *xrealloc(void *ptr, size_t size) __warn_unused_result;
+char *xstrdup(const char *s) __warn_unused_result;
static inline bool xstreq(const char *str1, const char *str2)
{