cbdataFree() in -HEAD ?

From: Adrian Chadd <adrian@dont-contact.us>
Date: Tue, 13 Mar 2001 06:23:44 +0800

Hi,

WHats this meant to do ?

#define cbdataFree(var) (var = (cbdataInternalFree(var), NULL))

If its meant to free var, then set var to NULL, its .. well,
bombing out on IRIX. :)

The FreeBSD way of doing evilness like this is something like the
following:

Index: defines.h
===================================================================
RCS file: /squid/squid/src/defines.h,v
retrieving revision 1.90
diff -u -r1.90 defines.h
--- defines.h 2001/03/03 10:39:31 1.90
+++ defines.h 2001/03/12 22:22:00
@@ -282,7 +282,7 @@
 
 /* cbdata macros */
 #define cbdataAlloc(type) ((type *)cbdataInternalAlloc(CBDATA_##type))
-#define cbdataFree(var) (var = (cbdataInternalFree(var), NULL))
+#define cbdataFree(var) do { cbdataInternalFree(var); (var) = NULL; } while (0)
 #define CBDATA_TYPE(type) static cbdata_type CBDATA_##type = 0
 #define CBDATA_GLOBAL_TYPE(type) cbdata_type CBDATA_##type
 #define CBDATA_INIT_TYPE(type) (CBDATA_##type ? 0 : (CBDATA_##type = cbdataAddType(CBDATA_##type, #type, sizeof(type), NULL)))

Is this ok ?

Adrian

-- 
Adrian Chadd		"The fact you can download a 100 megabyte file
<adrian@creative.net.au>  from half way around the world should be viewed
			    as an accident and not a right."
					-- Adrian Chadd and Bill Fumerola
Received on Mon Mar 12 2001 - 15:23:50 MST

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:13:37 MST