[prev in list] [next in list] [prev in thread] [next in thread]
List: squid-cvs
Subject: /bzr/squid3/trunk/ r12698: Fix nested debugs() calls
From: Amos Jeffries <squid3 () treenet ! co ! nz>
Date: 2013-02-18 11:37:32
Message-ID: 20130218114009.16484.qmail () squid-cache ! org
[Download RAW message or body]
--===============0817040891==
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
------------------------------------------------------------
revno: 12698
author: Alexander Komyagin <komyagin@altell.ru>
committer: Amos Jeffries <squid3@treenet.co.nz>
branch nick: trunk
timestamp: Tue 2013-02-19 00:37:32 +1300
message:
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().
modified:
src/Debug.h
--===============0817040891==
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"; name="r12698.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
=== modified file 'src/Debug.h'
--- a/src/Debug.h 2012-12-15 01:13:21 +0000
+++ b/src/Debug.h 2013-02-18 11:37:32 +0000
@@ -107,12 +107,13 @@
/* 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)
--===============0817040891==--
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic