Skip to content

Instantly share code, notes, and snippets.

@lfranchi
Created November 18, 2012 15:29
Show Gist options
  • Save lfranchi/4105819 to your computer and use it in GitHub Desktop.
Save lfranchi/4105819 to your computer and use it in GitHub Desktop.
Do not needlessly construct debug objects if no debug is shown
diff --git a/src/utils/debug.cpp b/src/utils/debug.cpp
index 6fac78f..adefeee 100644
--- a/src/utils/debug.cpp
+++ b/src/utils/debug.cpp
@@ -173,7 +173,7 @@ Block::Block( const char *label )
: m_label( label )
, m_color( s_colorIndex )
{
- if( !debugEnabled() )
+ if( !debugEnabled() || DEBUG_INFO < s_debugLevel)
return;
#if QT_VERSION >= 0x040700
@@ -193,7 +193,7 @@ Block::Block( const char *label )
Block::~Block()
{
- if( !debugEnabled() )
+ if( !debugEnabled() || DEBUG_INFO < s_debugLevel)
return;
#if QT_VERSION >= 0x040700
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment