]> granicus.if.org Git - icinga2/commitdiff
Only build leak detection code when I2_LEAK_DEBUG is set
authorGunnar Beutner <gunnar@beutner.name>
Tue, 19 Jan 2016 15:43:46 +0000 (16:43 +0100)
committerGunnar Beutner <gunnar@beutner.name>
Tue, 23 Feb 2016 09:46:17 +0000 (10:46 +0100)
refs #10963

lib/base/object.cpp
lib/base/object.hpp

index 2d2779a3875593cc1bfd1e77a02984ce09ddb5cf..cc53b8a25d6ea49dc6f66cca4ca4b36dd41d6431 100644 (file)
@@ -30,11 +30,11 @@ using namespace icinga;
 
 DEFINE_TYPE_INSTANCE(Object);
 
-#ifdef I2_DEBUG
+#ifdef I2_LEAK_DEBUG
 static boost::mutex l_ObjectCountLock;
 static std::map<String, int> l_ObjectCounts;
 static Timer::Ptr l_ObjectCountTimer;
-#endif
+#endif /* I2_LEAK_DEBUG */
 
 /**
  * Default constructor for the Object class.
@@ -128,7 +128,7 @@ Type::Ptr Object::GetReflectionType(void) const
        return Object::TypeInstance;
 }
 
-#ifdef I2_DEBUG
+#ifdef I2_LEAK_DEBUG
 void icinga::TypeAddObject(Object *object)
 {
        boost::mutex::scoped_lock lock(l_ObjectCountLock);
@@ -168,5 +168,5 @@ static void StartTypeInfoTimer(void)
 }
 
 INITIALIZE_ONCE(StartTypeInfoTimer);
-#endif /* I2_DEBUG */
+#endif /* I2_LEAK_DEBUG */
 
index 3001e4a69d0f1da7e25af9877fe886bd302815cc..c68f22fe5bb8425a452f3016f470b48a1a004a82 100644 (file)
@@ -139,10 +139,10 @@ void TypeRemoveObject(Object *object);
 
 inline void intrusive_ptr_add_ref(Object *object)
 {
-#ifdef I2_DEBUG
+#ifdef I2_LEAK_DEBUG
        if (object->m_References == 0)
                TypeAddObject(object);
-#endif /* I2_DEBUG */
+#endif /* I2_LEAK_DEBUG */
 
 #ifdef _WIN32
        InterlockedIncrement(&object->m_References);
@@ -162,9 +162,9 @@ inline void intrusive_ptr_release(Object *object)
 #endif /* _WIN32 */
 
        if (refs == 0) {
-#ifdef I2_DEBUG
+#ifdef I2_LEAK_DEBUG
                TypeRemoveObject(object);
-#endif /* I2_DEBUG */
+#endif /* I2_LEAK_DEBUG */
 
                delete object;
        }