BIND 10 trac2207, updated. 451973cb26da61f3e5d56c441ea54a28c34acaa3 [2207] Use state variable
BIND 10 source code commits
bind10-changes at lists.isc.org
Fri Oct 19 17:01:10 UTC 2012
The branch, trac2207 has been updated
via 451973cb26da61f3e5d56c441ea54a28c34acaa3 (commit)
from 83f878b651eb1be66dfcb1453cc074c2b5d3dc3f (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 451973cb26da61f3e5d56c441ea54a28c34acaa3
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date: Fri Oct 19 18:58:57 2012 +0200
[2207] Use state variable
Instead of several boolean variables.
-----------------------------------------------------------------------
Summary of changes:
src/lib/datasrc/memory/zone_writer_local.cc | 14 ++++++--------
src/lib/datasrc/memory/zone_writer_local.h | 11 +++++++----
2 files changed, 13 insertions(+), 12 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/lib/datasrc/memory/zone_writer_local.cc b/src/lib/datasrc/memory/zone_writer_local.cc
index de3d91b..a14cbff 100644
--- a/src/lib/datasrc/memory/zone_writer_local.cc
+++ b/src/lib/datasrc/memory/zone_writer_local.cc
@@ -33,8 +33,7 @@ ZoneWriterLocal::ZoneWriterLocal(ZoneTableSegmentLocal* segment,
origin_(origin),
rrclass_(rrclass),
zone_data_(NULL),
- loaded_(false),
- data_ready_(false)
+ state_(ZW_UNUSED)
{}
ZoneWriterLocal::~ZoneWriterLocal() {
@@ -45,7 +44,7 @@ ZoneWriterLocal::~ZoneWriterLocal() {
void
ZoneWriterLocal::load() {
- if (loaded_) {
+ if (state_ != ZW_UNUSED) {
isc_throw(isc::InvalidOperation, "Trying to load twice");
}
@@ -56,13 +55,12 @@ ZoneWriterLocal::load() {
isc_throw(isc::InvalidOperation, "No data returned from load action");
}
- loaded_ = true;
- data_ready_ = true;
+ state_ = ZW_LOADED;
}
void
ZoneWriterLocal::install() {
- if (!data_ready_) {
+ if (state_ != ZW_LOADED) {
isc_throw(isc::InvalidOperation, "No data to install");
}
@@ -75,7 +73,7 @@ ZoneWriterLocal::install() {
segment_->getMemorySegment(),
rrclass_, origin_, zone_data_));
- data_ready_ = false;
+ state_ = ZW_INSTALLED;
zone_data_ = result.zone_data;
}
@@ -86,7 +84,7 @@ ZoneWriterLocal::cleanup() {
if (zone_data_ != NULL) {
ZoneData::destroy(segment_->getMemorySegment(), zone_data_, rrclass_);
zone_data_ = NULL;
- data_ready_ = false;
+ state_ = ZW_CLEANED;
}
}
diff --git a/src/lib/datasrc/memory/zone_writer_local.h b/src/lib/datasrc/memory/zone_writer_local.h
index 366ae1a..7231a57 100644
--- a/src/lib/datasrc/memory/zone_writer_local.h
+++ b/src/lib/datasrc/memory/zone_writer_local.h
@@ -79,10 +79,13 @@ private:
dns::Name origin_;
dns::RRClass rrclass_;
ZoneData* zone_data_;
- // The load was performed
- bool loaded_;
- // The data are ready to be installed
- bool data_ready_;
+ enum State {
+ ZW_UNUSED,
+ ZW_LOADED,
+ ZW_INSTALLED,
+ ZW_CLEANED
+ };
+ State state_;
};
}
More information about the bind10-changes
mailing list