summaryrefslogtreecommitdiff
path: root/src/shared
diff options
context:
space:
mode:
Diffstat (limited to 'src/shared')
-rw-r--r--src/shared/fdset.h2
-rw-r--r--src/shared/set.h4
-rw-r--r--src/shared/strv.h2
-rw-r--r--src/shared/udev-util.h10
-rw-r--r--src/shared/util.h19
5 files changed, 19 insertions, 18 deletions
diff --git a/src/shared/fdset.h b/src/shared/fdset.h
index 6277e464d8..907acd76dd 100644
--- a/src/shared/fdset.h
+++ b/src/shared/fdset.h
@@ -49,5 +49,5 @@ int fdset_iterate(FDSet *s, Iterator *i);
#define FDSET_FOREACH(fd, fds, i) \
for ((i) = ITERATOR_FIRST, (fd) = fdset_iterate((fds), &(i)); (fd) >= 0; (fd) = fdset_iterate((fds), &(i)))
-define_trivial_cleanup_func(FDSet*, fdset_free)
+DEFINE_TRIVIAL_CLEANUP_FUNC(FDSet*, fdset_free);
#define _cleanup_fdset_free_ _cleanup_(fdset_freep)
diff --git a/src/shared/set.h b/src/shared/set.h
index a291470c19..5612478d4e 100644
--- a/src/shared/set.h
+++ b/src/shared/set.h
@@ -73,7 +73,7 @@ char **set_get_strv(Set *s);
#define SET_FOREACH_BACKWARDS(e, s, i) \
for ((i) = ITERATOR_LAST, (e) = set_iterate_backwards((s), &(i)); (e); (e) = set_iterate_backwards((s), &(i)))
-define_trivial_cleanup_func(Set*, set_free)
-define_trivial_cleanup_func(Set*, set_free_free)
+DEFINE_TRIVIAL_CLEANUP_FUNC(Set*, set_free);
+DEFINE_TRIVIAL_CLEANUP_FUNC(Set*, set_free_free);
#define _cleanup_set_free_ _cleanup_(set_freep)
#define _cleanup_set_free_free_ _cleanup_(set_free_freep)
diff --git a/src/shared/strv.h b/src/shared/strv.h
index 4d117f82c5..f6fb033a8c 100644
--- a/src/shared/strv.h
+++ b/src/shared/strv.h
@@ -30,7 +30,7 @@ char *strv_find(char **l, const char *name) _pure_;
char *strv_find_prefix(char **l, const char *name) _pure_;
void strv_free(char **l);
-define_trivial_cleanup_func(char**, strv_free)
+DEFINE_TRIVIAL_CLEANUP_FUNC(char**, strv_free);
#define _cleanup_strv_free_ _cleanup_(strv_freep)
char **strv_copy(char * const *l);
diff --git a/src/shared/udev-util.h b/src/shared/udev-util.h
index bff8f5fbf7..27677af876 100644
--- a/src/shared/udev-util.h
+++ b/src/shared/udev-util.h
@@ -24,11 +24,11 @@
#include "udev.h"
#include "util.h"
-define_trivial_cleanup_func(struct udev*, udev_unref)
-define_trivial_cleanup_func(struct udev_device*, udev_device_unref)
-define_trivial_cleanup_func(struct udev_enumerate*, udev_enumerate_unref)
-define_trivial_cleanup_func(struct udev_event*, udev_event_unref)
-define_trivial_cleanup_func(struct udev_rules*, udev_rules_unref)
+DEFINE_TRIVIAL_CLEANUP_FUNC(struct udev*, udev_unref);
+DEFINE_TRIVIAL_CLEANUP_FUNC(struct udev_device*, udev_device_unref);
+DEFINE_TRIVIAL_CLEANUP_FUNC(struct udev_enumerate*, udev_enumerate_unref);
+DEFINE_TRIVIAL_CLEANUP_FUNC(struct udev_event*, udev_event_unref);
+DEFINE_TRIVIAL_CLEANUP_FUNC(struct udev_rules*, udev_rules_unref);
#define _cleanup_udev_unref_ _cleanup_(udev_unrefp)
#define _cleanup_udev_device_unref_ _cleanup_(udev_device_unrefp)
diff --git a/src/shared/util.h b/src/shared/util.h
index 99a138cd8e..86b21435b2 100644
--- a/src/shared/util.h
+++ b/src/shared/util.h
@@ -556,11 +556,12 @@ 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); \
- } \
+#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) {
if (*fd >= 0)
@@ -571,10 +572,10 @@ static inline void umaskp(mode_t *u) {
umask(*u);
}
-define_trivial_cleanup_func(FILE*, fclose)
-define_trivial_cleanup_func(FILE*, pclose)
-define_trivial_cleanup_func(DIR*, closedir)
-define_trivial_cleanup_func(FILE*, endmntent)
+DEFINE_TRIVIAL_CLEANUP_FUNC(FILE*, fclose);
+DEFINE_TRIVIAL_CLEANUP_FUNC(FILE*, pclose);
+DEFINE_TRIVIAL_CLEANUP_FUNC(DIR*, closedir);
+DEFINE_TRIVIAL_CLEANUP_FUNC(FILE*, endmntent);
#define _cleanup_free_ _cleanup_(freep)
#define _cleanup_close_ _cleanup_(closep)