Commit c69d18ea authored by Pavel Emelyanov's avatar Pavel Emelyanov

util: More traditional xfree macro

Using do { } while (0) for statemets macro like this is a good practice.
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent ab59e7d3
...@@ -242,7 +242,7 @@ int do_open_proc(pid_t pid, int flags, const char *fmt, ...); ...@@ -242,7 +242,7 @@ int do_open_proc(pid_t pid, int flags, const char *fmt, ...);
#define xzalloc(size) __xalloc(calloc, size, 1, size) #define xzalloc(size) __xalloc(calloc, size, 1, size)
#define xrealloc(p, size) __xalloc(realloc, size, p, size) #define xrealloc(p, size) __xalloc(realloc, size, p, size)
#define xfree(p) if (p) free(p) #define xfree(p) do { if (p) free(p); } while (0)
#define xrealloc_safe(pptr, size) \ #define xrealloc_safe(pptr, size) \
({ \ ({ \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment