From: Gunnar Beutner Date: Tue, 19 Jan 2016 15:43:46 +0000 (+0100) Subject: Only build leak detection code when I2_LEAK_DEBUG is set X-Git-Tag: v2.5.0~611 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=db0c6ef187a5de14c2919d1fd1ae2f8d3801f49a;p=icinga2 Only build leak detection code when I2_LEAK_DEBUG is set refs #10963 --- diff --git a/lib/base/object.cpp b/lib/base/object.cpp index 2d2779a38..cc53b8a25 100644 --- a/lib/base/object.cpp +++ b/lib/base/object.cpp @@ -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 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 */ diff --git a/lib/base/object.hpp b/lib/base/object.hpp index 6eae786b9..26a4a31fa 100644 --- a/lib/base/object.hpp +++ b/lib/base/object.hpp @@ -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); @@ -163,9 +163,9 @@ inline void intrusive_ptr_release(Object *object) ASSERT(refs >= 0); if (refs == 0) { -#ifdef I2_DEBUG +#ifdef I2_LEAK_DEBUG TypeRemoveObject(object); -#endif /* I2_DEBUG */ +#endif /* I2_LEAK_DEBUG */ delete object; }