Bugzilla bug #39110: put PR_BEGIN_MACRO and PR_END_MACRO around
authorwtc%netscape.com
Mon, 22 May 2000 18:12:11 +0000
changeset 1371 61880cb66d07840c6af5fddc13f63659285f9254
parent 1370 cd1403be219a16f7f8f891b00de2e5d76e87c1de
child 1372 6b85c0bddfa68bd8bbe1d10e8089838e323b1f56
push idunknown
push userunknown
push dateunknown
bugs39110
Bugzilla bug #39110: put PR_BEGIN_MACRO and PR_END_MACRO around PR_DELETE and PR_FREEIF. Thanks to Erik van der Poel <erik@netscape.com> for the bug report and suggested fix.
pr/include/prmem.h
--- a/pr/include/prmem.h
+++ b/pr/include/prmem.h
@@ -116,25 +116,31 @@ NSPR_API(void) PR_Free(void *ptr);
 ** FUNCTION:	PR_DELETE()
 ** DESCRIPTION:
 **   PR_DELETE() unallocates an object previosly allocated via PR_NEW()
 **   or PR_NEWZAP() to the heap.
 ** INPUTS:	pointer to previously allocated object
 ** OUTPUTS:	the referenced object is returned to the heap
 ** RETURN:	void
 ***********************************************************************/
-#define PR_DELETE(_ptr) { PR_Free(_ptr); (_ptr) = NULL; }
+#define PR_DELETE(_ptr)                 \
+    PR_BEGIN_MACRO                      \
+        PR_Free(_ptr); (_ptr) = NULL;   \
+    PR_END_MACRO
 
 /***********************************************************************
 ** FUNCTION:	PR_FREEIF()
 ** DESCRIPTION:
 **   PR_FREEIF() conditionally unallocates an object previously allocated
 **   vial PR_NEW() or PR_NEWZAP(). If the pointer to the object is
 **   equal to zero (0), the object is not released.
 ** INPUTS:	pointer to previously allocated object
 ** OUTPUTS:	the referenced object is conditionally returned to the heap
 ** RETURN:	void
 ***********************************************************************/
-#define PR_FREEIF(_ptr)	if (_ptr) PR_DELETE(_ptr)
+#define PR_FREEIF(_ptr)             \
+    PR_BEGIN_MACRO                  \
+        if (_ptr) PR_DELETE(_ptr);  \
+    PR_END_MACRO
 
 PR_END_EXTERN_C
 
 #endif /* prmem_h___ */