Browse Source

lib: ptr macro arg may need brackets in some cases

Paul Jakma 8 years ago
parent
commit
bc69d45434
1 changed files with 2 additions and 2 deletions
  1. 2 2
      lib/memory.h

+ 2 - 2
lib/memory.h

@@ -50,7 +50,7 @@ extern struct mlist mlists[];
 #define XFREE(mtype, ptr) \
   do { \
     mtype_zfree (__FILE__, __LINE__, (mtype), (ptr)); \
-    ptr = NULL; } \
+    (ptr) = NULL; } \
   while (0)
 #define XSTRDUP(mtype, str) \
   mtype_zstrdup (__FILE__, __LINE__, (mtype), (str))
@@ -60,7 +60,7 @@ extern struct mlist mlists[];
 #define XREALLOC(mtype, ptr, size) zrealloc ((mtype), (ptr), (size))
 #define XFREE(mtype, ptr)          do { \
                                      zfree ((mtype), (ptr)); \
-                                     ptr = NULL; } \
+                                     (ptr) = NULL; } \
                                    while (0)
 #define XSTRDUP(mtype, str)        zstrdup ((mtype), (str))
 #endif /* MEMORY_LOG */