BIND 10 master, updated. 64ae9936d165c0e070bdf17809971918c29ee838 [3073] Merge branch 'trac3073'

BIND 10 source code commits bind10-changes at lists.isc.org
Mon Oct 28 03:50:27 UTC 2013


The branch, master has been updated
       via  64ae9936d165c0e070bdf17809971918c29ee838 (commit)
       via  e7fff7124061a6fb64dfb03d3e652de8b883305c (commit)
       via  d1397da715c4c2fd9039923250f380e3f1172fb3 (commit)
       via  2d83a3a525c255b565aa57e3bd5efce5ca38a269 (commit)
      from  ab5d8f7f2ce5d95cd09ee0d7ad6999ed7b2c09b4 (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 64ae9936d165c0e070bdf17809971918c29ee838
Merge: ab5d8f7 e7fff71
Author: Kean Johnston <kean at isc.org>
Date:   Mon Oct 28 05:49:50 2013 +0200

    [3073] Merge branch 'trac3073'

-----------------------------------------------------------------------

Summary of changes:
 src/lib/cc/data.cc                   |    5 +++++
 src/lib/cc/data.h                    |    4 ++++
 src/lib/cc/session.cc                |    2 +-
 src/lib/cc/tests/data_unittests.cc   |    6 ++++++
 src/lib/config/ccsession.cc          |    2 +-
 src/lib/config/tests/fake_session.cc |    8 ++++----
 src/lib/datasrc/client_list.cc       |    1 +
 7 files changed, 22 insertions(+), 6 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/lib/cc/data.cc b/src/lib/cc/data.cc
index 3518939..5f87d7c 100644
--- a/src/lib/cc/data.cc
+++ b/src/lib/cc/data.cc
@@ -145,6 +145,11 @@ Element::size() const {
     isc_throw(TypeError, "size() called on a non-list Element");
 }
 
+bool
+Element::empty() const {
+    isc_throw(TypeError, "empty() called on a non-list Element");
+}
+
 ConstElementPtr
 Element::get(const std::string&) const {
     isc_throw(TypeError, "get(string) called on a non-map Element");
diff --git a/src/lib/cc/data.h b/src/lib/cc/data.h
index 8050607..bea9dbb 100644
--- a/src/lib/cc/data.h
+++ b/src/lib/cc/data.h
@@ -210,6 +210,9 @@ public:
 
     /// Returns the number of elements in the list.
     virtual size_t size() const;
+
+    /// Return true if there are no elements in the list.
+    virtual bool empty() const;
     //@}
 
 
@@ -479,6 +482,7 @@ public:
     void remove(int i) { l.erase(l.begin() + i); };
     void toJSON(std::ostream& ss) const;
     size_t size() const { return (l.size()); }
+    bool empty() const { return (l.empty()); }
     bool equals(const Element& other) const;
 };
 
diff --git a/src/lib/cc/session.cc b/src/lib/cc/session.cc
index cb1ca39..0a2f11d 100644
--- a/src/lib/cc/session.cc
+++ b/src/lib/cc/session.cc
@@ -535,7 +535,7 @@ Session::reply(ConstElementPtr envelope, ConstElementPtr newmsg) {
 
 bool
 Session::hasQueuedMsgs() const {
-    return (impl_->queue_->size() > 0);
+    return (!impl_->queue_->empty());
 }
 
 void
diff --git a/src/lib/cc/tests/data_unittests.cc b/src/lib/cc/tests/data_unittests.cc
index a60c994..9568884 100644
--- a/src/lib/cc/tests/data_unittests.cc
+++ b/src/lib/cc/tests/data_unittests.cc
@@ -418,6 +418,7 @@ TEST(Element, create_and_value_throws) {
     EXPECT_THROW(el->add(el), TypeError);
     EXPECT_THROW(el->remove(1), TypeError);
     EXPECT_THROW(el->size(), TypeError);
+    EXPECT_THROW(el->empty(), TypeError);
     EXPECT_THROW(el->get("foo"), TypeError);
     EXPECT_THROW(el->set("foo", el), TypeError);
     EXPECT_THROW(el->remove("foo"), TypeError);
@@ -441,6 +442,7 @@ TEST(Element, create_and_value_throws) {
     EXPECT_THROW(el->add(el), TypeError);
     EXPECT_THROW(el->remove(1), TypeError);
     EXPECT_THROW(el->size(), TypeError);
+    EXPECT_THROW(el->empty(), TypeError);
     EXPECT_THROW(el->get("foo"), TypeError);
     EXPECT_THROW(el->set("foo", el), TypeError);
     EXPECT_THROW(el->remove("foo"), TypeError);
@@ -464,6 +466,7 @@ TEST(Element, create_and_value_throws) {
     EXPECT_THROW(el->add(el), TypeError);
     EXPECT_THROW(el->remove(1), TypeError);
     EXPECT_THROW(el->size(), TypeError);
+    EXPECT_THROW(el->empty(), TypeError);
     EXPECT_THROW(el->get("foo"), TypeError);
     EXPECT_THROW(el->set("foo", el), TypeError);
     EXPECT_THROW(el->remove("foo"), TypeError);
@@ -487,6 +490,7 @@ TEST(Element, create_and_value_throws) {
     EXPECT_THROW(el->add(el), TypeError);
     EXPECT_THROW(el->remove(1), TypeError);
     EXPECT_THROW(el->size(), TypeError);
+    EXPECT_THROW(el->empty(), TypeError);
     EXPECT_THROW(el->get("foo"), TypeError);
     EXPECT_THROW(el->set("foo", el), TypeError);
     EXPECT_THROW(el->remove("foo"), TypeError);
@@ -497,8 +501,10 @@ TEST(Element, create_and_value_throws) {
     testGetValueList<ConstElementPtr>();
 
     el = Element::createList();
+    EXPECT_TRUE(el->empty());
     v.push_back(Element::create(1));
     EXPECT_TRUE(el->setValue(v));
+    EXPECT_FALSE(el->empty());
     EXPECT_EQ("[ 1 ]", el->str());
 
     testGetValueMap<ElementPtr>();
diff --git a/src/lib/config/ccsession.cc b/src/lib/config/ccsession.cc
index 780fe95..cbe3a36 100644
--- a/src/lib/config/ccsession.cc
+++ b/src/lib/config/ccsession.cc
@@ -144,7 +144,7 @@ parseCommand(ConstElementPtr& arg, ConstElementPtr command) {
         command->contains(isc::cc::CC_PAYLOAD_COMMAND)) {
         ConstElementPtr cmd = command->get(isc::cc::CC_PAYLOAD_COMMAND);
         if (cmd->getType() == Element::list &&
-            cmd->size() > 0 &&
+            !cmd->empty() &&
             cmd->get(0)->getType() == Element::string) {
             if (cmd->size() > 1) {
                 arg = cmd->get(1);
diff --git a/src/lib/config/tests/fake_session.cc b/src/lib/config/tests/fake_session.cc
index e6d569e..c2fba57 100644
--- a/src/lib/config/tests/fake_session.cc
+++ b/src/lib/config/tests/fake_session.cc
@@ -104,7 +104,7 @@ FakeSession::recvmsg(ConstElementPtr& msg, bool nonblock, int) {
     //cout << "[XX] client asks for message " << endl;
     if (messages_ &&
         messages_->getType() == Element::list &&
-        messages_->size() > 0) {
+        !messages_->empty()) {
         msg = messages_->get(0);
         messages_->remove(0);
     } else {
@@ -127,7 +127,7 @@ FakeSession::recvmsg(ConstElementPtr& env, ConstElementPtr& msg, bool nonblock,
     env = ElementPtr();
     if (messages_ &&
         messages_->getType() == Element::list &&
-        messages_->size() > 0) {
+        !messages_->empty()) {
         // do we need initial message to have env[group] and [to] too?
         msg = messages_->get(0);
         messages_->remove(0);
@@ -210,13 +210,13 @@ FakeSession::reply(ConstElementPtr envelope, ConstElementPtr newmsg) {
 
 bool
 FakeSession::hasQueuedMsgs() const {
-    return (msg_queue_ && msg_queue_->size() > 0);
+    return (msg_queue_ && !msg_queue_->empty());
 }
 
 ConstElementPtr
 FakeSession::getFirstMessage(std::string& group, std::string& to) const {
     ConstElementPtr el;
-    if (msg_queue_ && msg_queue_->size() > 0) {
+    if (msg_queue_ && !msg_queue_->empty()) {
         el = msg_queue_->get(0);
         msg_queue_->remove(0);
         group = el->get(0)->stringValue();
diff --git a/src/lib/datasrc/client_list.cc b/src/lib/datasrc/client_list.cc
index 531821c..94afe96 100644
--- a/src/lib/datasrc/client_list.cc
+++ b/src/lib/datasrc/client_list.cc
@@ -83,6 +83,7 @@ ConfigurableClientList::configure(const ConstElementPtr& config,
     if (!config) {
         isc_throw(isc::BadValue, "NULL configuration passed");
     }
+
     // TODO: Implement recycling from the old configuration.
     size_t i(0); // Outside of the try to be able to access it in the catch
     try {



More information about the bind10-changes mailing list