From: Amos Jeffries Date: Fri, 1 Nov 2013 01:23:11 +0000 (-0600) Subject: Fix cbdata 'error: expression result unused' errors X-Git-Tag: SQUID_3_4_0_3~25 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=aecfb07f4ef815c2329d9b86e2e2e5299d2a04f8;p=thirdparty%2Fsquid.git Fix cbdata 'error: expression result unused' errors Detected by Clang. --- diff --git a/src/cbdata.h b/src/cbdata.h index d0b5d6aa8b..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 ? CBDATA_UNKNOWN : (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 ? CBDATA_UNKNOWN : (CBDATA_##type = cbdataInternalAddType(CBDATA_##type, #type, sizeof(type), free_func))) +#define CBDATA_INIT_TYPE(type) CBDATA_INIT_TYPE_FREECB(type, NULL) /** \ingroup CBDATA