BIND 10 trac1004, updated. 701c0d6d7c484c2f46951d23fba47c760363b7e4 [trac1004] clean up if-statement and don't use json for copy
BIND 10 source code commits
bind10-changes at lists.isc.org
Mon Jun 27 10:48:21 UTC 2011
The branch, trac1004 has been updated
via 701c0d6d7c484c2f46951d23fba47c760363b7e4 (commit)
from d57f30ffe93b7f45aa6492ea1fba5d594adc01df (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 701c0d6d7c484c2f46951d23fba47c760363b7e4
Author: Jelte Jansen <jelte at isc.org>
Date: Mon Jun 27 12:47:50 2011 +0200
[trac1004] clean up if-statement and don't use json for copy
-----------------------------------------------------------------------
Summary of changes:
src/lib/cc/data.h | 2 +-
src/lib/config/ccsession.cc | 15 +++++++++------
2 files changed, 10 insertions(+), 7 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/lib/cc/data.h b/src/lib/cc/data.h
index 0a363f4..5c731e6 100644
--- a/src/lib/cc/data.h
+++ b/src/lib/cc/data.h
@@ -479,7 +479,7 @@ public:
return (true);
}
using Element::setValue;
- bool setValue(std::map<std::string, ConstElementPtr>& v) {
+ bool setValue(const std::map<std::string, ConstElementPtr>& v) {
m = v;
return (true);
}
diff --git a/src/lib/config/ccsession.cc b/src/lib/config/ccsession.cc
index a1adcf8..8948442 100644
--- a/src/lib/config/ccsession.cc
+++ b/src/lib/config/ccsession.cc
@@ -271,18 +271,21 @@ getRelatedLoggers(ConstElementPtr loggers) {
std::string cur_name = cur_logger->get("name")->stringValue();
// if name is '*', or starts with '*.', replace * with root
// logger name
- if (cur_name.length() > 0 && cur_name[0] == '*' &&
- !(cur_name.length() > 1 && cur_name[1] != '.')) {
+ if (cur_name == "*" || cur_name.length() > 1 &&
+ cur_name[0] == '*' && cur_name[1] == '.') {
+
cur_name = root_name + cur_name.substr(1);
// now add it to the result list, but only if a logger with
// that name was not configured explicitely
if (our_names.find(cur_name) == our_names.end()) {
// we substitute the name here already, but as
// we are dealing with consts, we copy the data
- // there's no direct copy (yet), but we can use JSON
- ElementPtr new_logger = isc::data::Element::fromJSON(cur_logger->str());
- ConstElementPtr new_name = Element::create(cur_name);
- new_logger->set("name", new_name);
+ ElementPtr new_logger(Element::createMap());
+ // since we'll only be updating one first-level element,
+ // and we return as const again, a shallow map copy is
+ // enough
+ new_logger->setValue(cur_logger->mapValue());
+ new_logger->set("name", Element::create(cur_name));
result->add(new_logger);
}
}
More information about the bind10-changes
mailing list