summaryrefslogtreecommitdiff
path: root/src/shared/macro.h
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2015-01-17 23:20:00 -0500
committerAnthony G. Basile <blueness@gentoo.org>2015-01-25 16:50:37 -0500
commit475b84c01a3a12d052e470e6d99e5e9877f78ba1 (patch)
tree6dd648ae4a3a1e325ffafebc87a595a4ff2d0b52 /src/shared/macro.h
parent6d90157e448a4938aad0bd208c5f192f14b3ef8d (diff)
Move DEFINE_TRIVIAL_CLEANUP_FUNC to macro.h
This remove the need for various header files to include the (relatively heavyweight) util.h. Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
Diffstat (limited to 'src/shared/macro.h')
-rw-r--r--src/shared/macro.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/shared/macro.h b/src/shared/macro.h
index 41fe61fb68..6aa6d98913 100644
--- a/src/shared/macro.h
+++ b/src/shared/macro.h
@@ -241,4 +241,11 @@ static inline size_t IOVEC_INCREMENT(struct iovec *i, unsigned n, size_t k) {
#define GID_INVALID ((gid_t) -1)
#define MODE_INVALID ((mode_t) -1)
+#define DEFINE_TRIVIAL_CLEANUP_FUNC(type, func) \
+ static inline void func##p(type *p) { \
+ if (*p) \
+ func(*p); \
+ } \
+ struct __useless_struct_to_allow_trailing_semicolon__
+
#include "log.h"