From 9a6a1d0ef02fbbcf5052d581b45b0170b3bcc683 Mon Sep 17 00:00:00 2001 From: Amos Jeffries Date: Sun, 3 Nov 2013 01:32:24 -0700 Subject: [PATCH] Fix cbdata 'error: expression result unused' errors Detected by Clang. --- src/cbdata.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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 -- 2.47.2