From: Amos Jeffries Date: Sat, 26 Oct 2013 06:09:56 +0000 (-0600) Subject: Better fix for CBDATA type errors X-Git-Tag: SQUID_3_5_0_1~581 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b225f6b240eac049ebc11dc2fbdfc2f3e5c767d0;p=thirdparty%2Fsquid.git Better fix for CBDATA type errors --- diff --git a/src/cbdata.h b/src/cbdata.h index f29862180a..769061644f 100644 --- a/src/cbdata.h +++ b/src/cbdata.h @@ -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