]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Better fix for CBDATA type errors
authorAmos Jeffries <squid3@treenet.co.nz>
Sat, 26 Oct 2013 06:09:56 +0000 (00:09 -0600)
committerAmos Jeffries <squid3@treenet.co.nz>
Sat, 26 Oct 2013 06:09:56 +0000 (00:09 -0600)
src/cbdata.h

index f29862180a27b491a782cb4dbcd9b33210894575..769061644fa5077eb468608676d69a0495b9d55e 100644 (file)
@@ -412,11 +412,12 @@ cbdata_type cbdataInternalAddType(cbdata_type type, const char *label, int size,
  * Initializes the cbdatatype. Must be called prior to the first use of cbdataAlloc() for the type.
  *
  \par
- * Alternative to CBDATA_INIT_TYPE_FREECB()
+ * Alternative to CBDATA_INIT_TYPE()
  *
  \param type           Type being initialized
+ \param free_func      The freehandler called when the last known reference to an allocated entry goes away.
  */
-#define CBDATA_INIT_TYPE(type) (CBDATA_##type ? (void)0 : (CBDATA_##type = cbdataInternalAddType(CBDATA_##type, #type, sizeof(type), NULL)))
+#define CBDATA_INIT_TYPE_FREECB(type, free_func) do { if (!CBDATA_##type) CBDATA_##type = cbdataInternalAddType(CBDATA_##type, #type, sizeof(type), free_func); } while (false)
 
 /**
  \ingroup CBDATAAPI
@@ -424,12 +425,11 @@ cbdata_type cbdataInternalAddType(cbdata_type type, const char *label, int size,
  * Initializes the cbdatatype. Must be called prior to the first use of cbdataAlloc() for the type.
  *
  \par
- * Alternative to CBDATA_INIT_TYPE()
+ * Alternative to CBDATA_INIT_TYPE_FREECB()
  *
  \param type           Type being initialized
- \param free_func      The freehandler called when the last known reference to an allocated entry goes away.
  */
-#define CBDATA_INIT_TYPE_FREECB(type, free_func)       (CBDATA_##type ? (void)0 : (CBDATA_##type = cbdataInternalAddType(CBDATA_##type, #type, sizeof(type), free_func)))
+#define CBDATA_INIT_TYPE(type) CBDATA_INIT_TYPE_FREECB(type, NULL)
 
 /**
  \ingroup CBDATA