summaryrefslogtreecommitdiffstats
path: root/util.h
diff options
context:
space:
mode:
authorDave Reisner <dreisner@archlinux.org>2014-11-16 16:51:30 -0500
committerDave Reisner <dreisner@archlinux.org>2014-11-16 16:54:30 -0500
commitc16a1cea13c70e9c40a8db82d561e71bd04f404f (patch)
tree1adf263ea9a8b1d7b2f84d0e858571a4888606f2 /util.h
parent13145a3957ac029fc5e3f538f676c0075255822d (diff)
downloadexpac-c16a1cea13c70e9c40a8db82d561e71bd04f404f.tar.xz
Reorg a bit, introduce a control struct
Diffstat (limited to 'util.h')
-rw-r--r--util.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/util.h b/util.h
new file mode 100644
index 0000000..6d50426
--- /dev/null
+++ b/util.h
@@ -0,0 +1,14 @@
+#ifndef _UTIL_H
+#define _UTIL_H
+
+#include <glob.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+static inline void freep(void *p) { free(*(void **)p); }
+static inline void fclosep(FILE **p) { if (*p) fclose(*p); }
+static inline void globfreep(glob_t *p) { globfree(p); }
+#define _cleanup_(x) __attribute__((cleanup(x)))
+#define _cleanup_free_ _cleanup_(freep)
+
+#endif /* _UTIL_H */