From: Amos Jeffries Date: Sun, 3 Nov 2013 08:32:24 +0000 (-0700) Subject: Fix cbdata 'error: expression result unused' errors X-Git-Tag: SQUID_3_3_10~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9a6a1d0ef02fbbcf5052d581b45b0170b3bcc683;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 5c73dc5b44..e765f850df 100644 --- a/src/cbdata.h +++ b/src/cbdata.h @@ -415,11 +415,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 @@ -427,12 +428,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