]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Fix CBDATA_CLASS2 macro definition
authorAmos Jeffries <squid3@treenet.co.nz>
Wed, 9 Oct 2013 14:04:57 +0000 (08:04 -0600)
committerAmos Jeffries <squid3@treenet.co.nz>
Wed, 9 Oct 2013 14:04:57 +0000 (08:04 -0600)
CBDATA_UNKNOWN was being used in place of a void no-op statement.
This was incorrect and useless. Now that the value definition is fixed
it is being picked up by the stricter compilers.
Replace the trinary conditional with an if-statement.

src/cbdata.h

index f480596ee14453aff7e32838618b554a8106a244..d0b5d6aa8b70f830254f873ec60d890b43c49dcc 100644 (file)
@@ -285,7 +285,8 @@ cbdata_type cbdataInternalAddType(cbdata_type type, const char *label, int size,
        public: \
                void *operator new(size_t size) { \
                  assert(size == sizeof(type)); \
-                 (CBDATA_##type ?  CBDATA_UNKNOWN : (CBDATA_##type = cbdataInternalAddType(CBDATA_##type, #type, sizeof(type), NULL))); \
+                 if (!CBDATA_##type) \
+                      CBDATA_##type = cbdataInternalAddType(CBDATA_##type, #type, sizeof(type), NULL); \
                  return cbdataInternalAllocDbg(CBDATA_##type,__FILE__,__LINE__); \
                } \
                void operator delete (void *address) { \
@@ -332,7 +333,7 @@ cbdata_type cbdataInternalAddType(cbdata_type type, const char *label, int size,
 /**
  * \ingroup CBDATAAPI
  *
- * This needs to be defined LAST in teh class definition. It plays with private/public states in C++.
+ * This needs to be defined LAST in the class definition. It plays with private/public states in C++.
  */
 #define CBDATA_CLASS2(type)    \
        private: \
@@ -340,7 +341,8 @@ cbdata_type cbdataInternalAddType(cbdata_type type, const char *label, int size,
        public: \
                void *operator new(size_t size) { \
                  assert(size == sizeof(type)); \
-                 (CBDATA_##type ?  CBDATA_UNKNOWN : (CBDATA_##type = cbdataInternalAddType(CBDATA_##type, #type, sizeof(type), NULL))); \
+                 if (!CBDATA_##type) \
+                      CBDATA_##type = cbdataInternalAddType(CBDATA_##type, #type, sizeof(type), NULL); \
                  return (type *)cbdataInternalAlloc(CBDATA_##type); \
                } \
                void operator delete (void *address) { \