diff options
author | David Herrmann <dh.herrmann@gmail.com> | 2015-07-31 19:56:38 +0200 |
---|---|---|
committer | David Herrmann <dh.herrmann@gmail.com> | 2015-07-31 19:56:38 +0200 |
commit | 97b11eedff9d2e17101ad453caf9e48b73246719 (patch) | |
tree | add86c36a039f2cbeb8232908c7a0cb3ca784ea5 /src/basic/util.h | |
parent | b2a0ac5e5b29c73ca7c0da23369a4769d5a91ddd (diff) |
tree-wide: introduce mfree()
Pretty trivial helper which wraps free() but returns NULL, so we can
simplify this:
free(foobar);
foobar = NULL;
to this:
foobar = mfree(foobar);
Diffstat (limited to 'src/basic/util.h')
-rw-r--r-- | src/basic/util.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/basic/util.h b/src/basic/util.h index c2e5cc610b..06c82665be 100644 --- a/src/basic/util.h +++ b/src/basic/util.h @@ -84,6 +84,11 @@ bool streq_ptr(const char *a, const char *b) _pure_; #define malloc0(n) (calloc((n), 1)) +static inline void *mfree(void *memory) { + free(memory); + return NULL; +} + static inline const char* yes_no(bool b) { return b ? "yes" : "no"; } |