]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Fix cbdata 'error: expression result unused' errors
authorAmos Jeffries <squid3@treenet.co.nz>
Fri, 1 Nov 2013 01:23:11 +0000 (19:23 -0600)
committerAmos Jeffries <squid3@treenet.co.nz>
Fri, 1 Nov 2013 01:23:11 +0000 (19:23 -0600)
Detected by Clang.

src/cbdata.h

index d0b5d6aa8b70f830254f873ec60d890b43c49dcc..769061644fa5077eb468608676d69a0495b9d55e 100644 (file)
@@ -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