]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Fix cbdata 'error: expression result unused' errors
authorAmos Jeffries <squid3@treenet.co.nz>
Sun, 3 Nov 2013 08:32:24 +0000 (01:32 -0700)
committerAmos Jeffries <squid3@treenet.co.nz>
Sun, 3 Nov 2013 08:32:24 +0000 (01:32 -0700)
Detected by Clang.

src/cbdata.h

index 5c73dc5b443dc48254f1bfe30e63b821c978e926..e765f850df0e279e3060dc25fb623a4c50762eb3 100644 (file)
@@ -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