From: Alexander Komyagin Date: Mon, 18 Feb 2013 11:37:32 +0000 (+1300) Subject: Fix nested debugs() calls X-Git-Tag: SQUID_3_4_0_1~263 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5c2e1dab389048071cdce7aaffd7d0de6316d24b;p=thirdparty%2Fsquid.git Fix nested debugs() calls Since debugs() is a macro, it should not change static Debugs::level before putting the debug message to the internal stream. Otherwise we encounter problems when debug message itself containg calls to debugs(). --- diff --git a/src/Debug.h b/src/Debug.h index 18c01ca491..eebb2b3040 100644 --- a/src/Debug.h +++ b/src/Debug.h @@ -107,12 +107,13 @@ const char * SkipBuildPrefix(const char* path); /* Debug stream */ #define debugs(SECTION, LEVEL, CONTENT) \ do { \ - if ((Debug::level = (LEVEL)) <= Debug::Levels[SECTION]) { \ + if ((LEVEL) <= Debug::Levels[SECTION]) { \ Debug::sectionLevel = Debug::Levels[SECTION]; \ std::ostream &_dbo=Debug::getDebugOut(); \ - if (Debug::level > DBG_IMPORTANT) \ + if ((LEVEL) > DBG_IMPORTANT) \ _dbo << SkipBuildPrefix(__FILE__)<<"("<<__LINE__<<") "<<__FUNCTION__<<": "; \ _dbo << CONTENT; \ + Debug::level = (LEVEL); \ Debug::finishDebug(); \ } \ } while (/*CONSTCOND*/ 0)