Move DEFINE_TRIVIAL_CLEANUP_FUNC to macro.h

This remove the need for various header files to include the
(relatively heavyweight) util.h.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2015-01-18 19:06:48 -05:00
parent 2695c5c44e
commit a2341f6836
6 changed files with 10 additions and 12 deletions
+7
View File
@@ -446,4 +446,11 @@ do { \
#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"
+1 -1
View File
@@ -22,7 +22,7 @@
***/
#include "hashmap.h"
#include "util.h"
#include "macro.h"
Set *internal_set_new(const struct hash_ops *hash_ops HASHMAP_DEBUG_PARAMS);
#define set_new(ops) internal_set_new(ops HASHMAP_DEBUG_SRC_ARGS)
-7
View File
@@ -664,13 +664,6 @@ static inline void freep(void *p) {
free(*(void**) p);
}
#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__
static inline void closep(int *fd) {
safe_close(*fd);
}