]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
cbdataFree rewritten to have a single thread of execution with no
authorhno <>
Tue, 20 Mar 2001 08:10:25 +0000 (08:10 +0000)
committerhno <>
Tue, 20 Mar 2001 08:10:25 +0000 (08:10 +0000)
void data (only pointers).

src/cbdata.cc
src/defines.h
src/protos.h

index 85630f1d51343aacbffba8e2f698ed67c1ea7d01..89ffa7b75df9f1eb4e06715836ec128b1551100c 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: cbdata.cc,v 1.38 2001/03/03 10:39:31 hno Exp $
+ * $Id: cbdata.cc,v 1.39 2001/03/20 01:10:25 hno Exp $
  *
  * DEBUG: section 45    Callback Data Registry
  * ORIGINAL AUTHOR: Duane Wessels
@@ -175,13 +175,11 @@ cbdataInternalAlloc(cbdata_type type)
     return (void *) &p->data;
 }
 
-void
+void *
 cbdataInternalFree(void *p)
 {
     cbdata *c;
     FREE *free_func;
-    if (!p)
-       return;
     debug(45, 3) ("cbdataFree: %p\n", p);
     c = (cbdata *) (((char *) p) - OFFSET_OF(cbdata, data));
     assert(c->y == c);
@@ -189,7 +187,7 @@ cbdataInternalFree(void *p)
     if (c->locks) {
        debug(45, 3) ("cbdataFree: %p has %d locks, not freeing\n",
            p, c->locks);
-       return;
+       return NULL;
     }
     cbdataCount--;
     debug(45, 3) ("cbdataFree: Freeing %p\n", p);
@@ -197,6 +195,7 @@ cbdataInternalFree(void *p)
     if (free_func)
        free_func((void *) p);
     memPoolFree(cbdata_index[c->type].pool, c);
+    return NULL;
 }
 
 int
index e4808fbc4b7156dedac178ce22eb258af7d24d47..c3cd1ef46d2296cce88430df9ae3b06ab6466ea6 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: defines.h,v 1.90 2001/03/03 10:39:31 hno Exp $
+ * $Id: defines.h,v 1.91 2001/03/20 01:10:25 hno Exp $
  *
  *
  * SQUID Web Proxy Cache          http://www.squid-cache.org/
 
 /* cbdata macros */
 #define cbdataAlloc(type) ((type *)cbdataInternalAlloc(CBDATA_##type))
-#define cbdataFree(var) (var = (cbdataInternalFree(var), NULL))
+#define cbdataFree(var) (var = (var != NULL ? cbdataInternalFree(var): NULL))
 #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)))
index 8066b44dc666ce6b0ea14c777337c711a7e459a0..3b8f443fcf2914101f60b43b86258836b8203776 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: protos.h,v 1.400 2001/03/03 10:39:33 hno Exp $
+ * $Id: protos.h,v 1.401 2001/03/20 01:10:25 hno Exp $
  *
  *
  * SQUID Web Proxy Cache          http://www.squid-cache.org/
@@ -110,7 +110,7 @@ extern void cbdataLock(const void *p);
 extern void cbdataUnlock(const void *p);
 #endif
 /* Note: Allocations is done using the cbdataAlloc macro */
-extern void cbdataInternalFree(void *p);
+extern void *cbdataInternalFree(void *p);
 extern int cbdataValid(const void *p);
 extern void cbdataInitType(cbdata_type type, char *label, int size, FREE * free_func);
 extern cbdata_type cbdataAddType(cbdata_type type, char *label, int size, FREE * free_func);