diff options
author | Lennart Poettering <lennart@poettering.net> | 2012-09-13 22:30:26 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2012-09-13 22:30:26 +0200 |
commit | 2fbe635a83a79f8889afec421ae3990ea106fb91 (patch) | |
tree | 99789cfa152da47458500fd09e978a7f9099e46d /src/shared/macro.h | |
parent | a1d41e17a5c3861becd66f1c9dba7eb39ae4c478 (diff) |
macro: introduce _cleanup_free_ macro for automatic freeing of scoped vars and make use of it
Diffstat (limited to 'src/shared/macro.h')
-rw-r--r-- | src/shared/macro.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/shared/macro.h b/src/shared/macro.h index 4595750394..df17617b1e 100644 --- a/src/shared/macro.h +++ b/src/shared/macro.h @@ -187,4 +187,7 @@ 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))) + #include "log.h" |