summaryrefslogtreecommitdiff
path: root/src/utils.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils.h')
-rw-r--r--src/utils.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/utils.h b/src/utils.h
index 841579d..32d8b4b 100644
--- a/src/utils.h
+++ b/src/utils.h
@@ -22,6 +22,12 @@ static inline void freep(void **p)
free(*p);
}
+static inline void string_freep(char **p)
+{
+ if (*p)
+ free(*p);
+}
+
#define DEFINE_TRIVIAL_CLEANUP_FUNC(type, func) \
static inline void func##p(type *p) \
{ \
@@ -31,6 +37,7 @@ static inline void freep(void **p)
#define _cleanup_(_some_) __attribute__((__cleanup__(_some_)))
#define _cleanup_free_ _cleanup_(freep)
+#define _cleanup_string_ _cleanup_(string_freep)
#ifdef __cplusplus
}