chiark / gitweb /
install: use automatic cleanup
[elogind.git] / src / shared / macro.h
index 4595750394d8a2a5d43c68d27d46eb0d1ec55a64..f8c5656538ac9c41f341f4dabaffd73cca74feec 100644 (file)
@@ -187,4 +187,9 @@ static inline size_t IOVEC_INCREMENT(struct iovec *i, unsigned n, size_t k) {
         return k;
 }
 
+#define _cleanup_free_ __attribute__((cleanup(freep)))
+#define _cleanup_fclose_ __attribute__((cleanup(fclosep)))
+#define _cleanup_close_ __attribute__((cleanup(closep)))
+#define _cleanup_closedir_ __attribute__((cleanup(closedirp)))
+
 #include "log.h"