[cpp-xmltooling] 01/02: Conditional NDC behavior.
Scott Cantor
cantor.2 at osu.edu
Fri Apr 20 14:23:34 EDT 2018
This is an automated email from the git hooks/post-receive script.
scantor pushed a commit to branch master
in repository cpp-xmltooling.
View the commit online:
http://git.shibboleth.net/view/?p=cpp-xmltooling.git;a=commit;h=d4cd4719ca52def8e0e7381c15d70467cd5bb466
commit d4cd4719ca52def8e0e7381c15d70467cd5bb466
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Fri Apr 20 14:23:09 2018 -0400
Conditional NDC behavior.
---
xmltooling/util/NDC.cpp | 17 ++++++++++++-----
xmltooling/util/NDC.h | 3 +++
2 files changed, 15 insertions(+), 5 deletions(-)
diff --git a/xmltooling/util/NDC.cpp b/xmltooling/util/NDC.cpp
index 496e49f..ad54a91 100644
--- a/xmltooling/util/NDC.cpp
+++ b/xmltooling/util/NDC.cpp
@@ -36,17 +36,24 @@
using namespace xmltooling;
-NDC::NDC(const char* context)
+NDC::NDC(const char* context) : m_pop(false)
{
- logging::NDC::push(context);
+ if (context) {
+ logging::NDC::push(context);
+ m_pop = true;
+ }
}
-NDC::NDC(const std::string& context)
+NDC::NDC(const std::string& context) : m_pop(false)
{
- logging::NDC::push(context);
+ if (!context.empty()) {
+ logging::NDC::push(context);
+ m_pop = true;
+ }
}
NDC::~NDC()
{
- logging::NDC::pop();
+ if (m_pop)
+ logging::NDC::pop();
}
diff --git a/xmltooling/util/NDC.h b/xmltooling/util/NDC.h
index 6ad72a6..3fe0c56 100644
--- a/xmltooling/util/NDC.h
+++ b/xmltooling/util/NDC.h
@@ -56,6 +56,9 @@ namespace xmltooling {
* Destructor pops context off of diagnostic stack
*/
~NDC();
+
+ private:
+ bool m_pop;
};
};
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list