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);
This commit is contained in:
@@ -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";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user