BIND 10 trac2427, updated. 23a5c8f5a97538d51389303ebef46164f95cd317 [2427] Use pointer for last_name_
BIND 10 source code commits
bind10-changes at lists.isc.org
Mon Dec 17 11:56:42 UTC 2012
The branch, trac2427 has been updated
via 23a5c8f5a97538d51389303ebef46164f95cd317 (commit)
from 8e839a08dc0c54d88c6e5a93b2be00f8eb81c2f9 (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 23a5c8f5a97538d51389303ebef46164f95cd317
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date: Mon Dec 17 12:54:33 2012 +0100
[2427] Use pointer for last_name_
Instead of a Name directly and paired bool to check if it was
initialized. This avoids using a "dummy" value to initialize it, because
Name can't be uninitialized.
-----------------------------------------------------------------------
Summary of changes:
src/lib/dns/master_loader.cc | 17 +++++++----------
1 file changed, 7 insertions(+), 10 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/lib/dns/master_loader.cc b/src/lib/dns/master_loader.cc
index 85ec989..2c53449 100644
--- a/src/lib/dns/master_loader.cc
+++ b/src/lib/dns/master_loader.cc
@@ -23,10 +23,12 @@
#include <string>
#include <memory>
#include <boost/algorithm/string/predicate.hpp> // for iequals
+#include <boost/scoped_ptr.hpp>
using std::string;
using std::auto_ptr;
using boost::algorithm::iequals;
+using boost::scoped_ptr;
namespace isc {
namespace dns {
@@ -56,8 +58,6 @@ public:
lexer_(),
zone_origin_(zone_origin),
active_origin_(zone_origin),
- last_name_(Name::ROOT_NAME()), // Initialize with something,
- // we don't care
zone_class_(zone_class),
callbacks_(callbacks),
add_callback_(add_callback),
@@ -66,7 +66,6 @@ public:
initialized_(false),
ok_(true),
many_errors_((options & MANY_ERRORS) != 0),
- seen_name_(false),
complete_(false),
seen_error_(false)
{}
@@ -208,7 +207,7 @@ private:
const Name zone_origin_;
Name active_origin_; // The origin used during parsing
// (modifiable by $ORIGIN)
- Name last_name_; // Last seen name during the parsing.
+ scoped_ptr<Name> last_name_; // Last seen name (for INITAL_WS handling)
const RRClass zone_class_;
MasterLoaderCallbacks callbacks_;
AddRRCallback add_callback_;
@@ -219,7 +218,6 @@ private:
bool ok_; // Is it OK to continue loading?
const bool many_errors_; // Are many errors allowed (or should we abort
// on the first)
- bool seen_name_; // Did we parse at least one name?
public:
bool complete_; // All work done.
bool seen_error_; // Was there at least one error during the
@@ -292,12 +290,11 @@ MasterLoader::MasterLoaderImpl::loadIncremental(size_t count_limit) {
continue;
}
- last_name_ = Name(name_string.beg, name_string.len,
- &active_origin_);
- seen_name_ = true;
+ last_name_.reset(new Name(name_string.beg, name_string.len,
+ &active_origin_));
} else if (initial_token.getType() == MasterToken::INITIAL_WS) {
// This means the same name as previous.
- if (!seen_name_) {
+ if (last_name_.get() == NULL) {
isc_throw(InternalException, "No previous name to use in "
"place of initial whitespace");
}
@@ -337,7 +334,7 @@ MasterLoader::MasterLoaderImpl::loadIncremental(size_t count_limit) {
// callbacks_ already. We need to decide if we want to continue
// or not.
if (data) {
- add_callback_(last_name_, rrclass, rrtype, ttl, data);
+ add_callback_(*last_name_, rrclass, rrtype, ttl, data);
// Good, we loaded another one
++count;
More information about the bind10-changes
mailing list