BIND 10 trac2268, updated. a475756bf185c9e364ed00e245e307789e22fed3 [2268] Remove the RdataSet sorting code
BIND 10 source code commits
bind10-changes at lists.isc.org
Thu Oct 4 19:35:42 UTC 2012
The branch, trac2268 has been updated
via a475756bf185c9e364ed00e245e307789e22fed3 (commit)
from 27be672609dde261c85ffc671f1026277cfc3e9a (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 a475756bf185c9e364ed00e245e307789e22fed3
Author: Mukund Sivaraman <muks at isc.org>
Date: Fri Oct 5 00:51:29 2012 +0530
[2268] Remove the RdataSet sorting code
It was discussed on Jabber and we decided to defer it.
-----------------------------------------------------------------------
Summary of changes:
src/lib/datasrc/memory/zone_data_updater.cc | 67 +-------------------
.../datasrc/tests/memory/memory_client_unittest.cc | 12 ++--
2 files changed, 8 insertions(+), 71 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/lib/datasrc/memory/zone_data_updater.cc b/src/lib/datasrc/memory/zone_data_updater.cc
index f5a85a4..864f66d 100644
--- a/src/lib/datasrc/memory/zone_data_updater.cc
+++ b/src/lib/datasrc/memory/zone_data_updater.cc
@@ -27,53 +27,6 @@ namespace isc {
namespace datasrc {
namespace memory {
-namespace { // unnamed namespace
-
-// Returns a value-less than, or greater-than zero if 'a' is less-than
-// or greater-than 'b'. If they are equal, it returns 0. The comparison
-// function is such that often-used types such as A, AAAA, NS, SOA, MX,
-// etc. are less than other types. See the code for the ordering.
-int
-compareTypes(const RdataSet* a, const RdataSet* b) {
- // First RRType::A()
- if (a->type == RRType::A()) {
- return (-1);
- } else if (b->type == RRType::A()) {
- return (1);
- }
-
- // Then, RRType::AAAA(), etc.
- if (a->type == RRType::AAAA()) {
- return (-1);
- } else if (b->type == RRType::AAAA()) {
- return (1);
- }
-
- if (a->type == RRType::NS()) {
- return (-1);
- } else if (b->type == RRType::NS()) {
- return (1);
- }
-
- if (a->type == RRType::SOA()) {
- return (-1);
- } else if (b->type == RRType::SOA()) {
- return (1);
- }
-
- if (a->type == RRType::MX()) {
- return (-1);
- } else if (b->type == RRType::MX()) {
- return (1);
- }
-
- // Everything else comes in front of the rest of the list, so that
- // we can insert quickly.
- return (-1);
-}
-
-} // end of unnamed namespace
-
void
ZoneDataUpdater::addWildcards(const Name& name) {
Name wname(name);
@@ -314,24 +267,8 @@ ZoneDataUpdater::addRdataSet(const ConstRRsetPtr rrset,
RdataSet* rdataset_new = RdataSet::create(mem_sgmt_, encoder_,
rrset, rrsig);
-
- // Insertion sort the new RdataSet into place in the list.
- RdataSet* prev = NULL;
- RdataSet* current = rdataset_head;
- for (; current != NULL; current = current->getNext()) {
- if (compareTypes(rdataset_new, current) < 0) {
- break;
- }
-
- prev = current;
- }
-
- rdataset_new->next = current;
- if (prev != NULL) {
- prev->next = rdataset_new;
- } else {
- node->setData(rdataset_new);
- }
+ rdataset_new->next = rdataset_head;
+ node->setData(rdataset_new);
// Ok, we just put it in.
diff --git a/src/lib/datasrc/tests/memory/memory_client_unittest.cc b/src/lib/datasrc/tests/memory/memory_client_unittest.cc
index 80bc73f..c078105 100644
--- a/src/lib/datasrc/tests/memory/memory_client_unittest.cc
+++ b/src/lib/datasrc/tests/memory/memory_client_unittest.cc
@@ -222,13 +222,13 @@ TEST_F(MemoryClientTest, loadFromIterator) {
// RRType::MX() RRset
rrset = iterator->getNextRRset();
EXPECT_TRUE(rrset);
- EXPECT_EQ(RRType::A(), rrset->getType());
+ EXPECT_EQ(RRType::MX(), rrset->getType());
EXPECT_EQ(1, rrset->getRRsigDataCount()); // this RRset is signed
// RRType::A() RRset
rrset = iterator->getNextRRset();
EXPECT_TRUE(rrset);
- EXPECT_EQ(RRType::MX(), rrset->getType());
+ EXPECT_EQ(RRType::A(), rrset->getType());
EXPECT_EQ(1, rrset->getRRsigDataCount()); // also signed
// There's nothing else in this iterator
@@ -364,11 +364,11 @@ TEST_F(MemoryClientTest, loadReloadZone) {
set = node->getData();
EXPECT_NE(static_cast<const RdataSet*>(NULL), set);
- EXPECT_EQ(RRType::A(), set->type);
+ EXPECT_EQ(RRType::AAAA(), set->type);
set = set->getNext();
EXPECT_NE(static_cast<const RdataSet*>(NULL), set);
- EXPECT_EQ(RRType::AAAA(), set->type);
+ EXPECT_EQ(RRType::A(), set->type);
set = set->getNext();
EXPECT_EQ(static_cast<const RdataSet*>(NULL), set);
@@ -754,11 +754,11 @@ TEST_F(MemoryClientTest, findZoneData) {
set = node->getData();
EXPECT_NE(static_cast<const RdataSet*>(NULL), set);
- EXPECT_EQ(RRType::A(), set->type);
+ EXPECT_EQ(RRType::AAAA(), set->type);
set = set->getNext();
EXPECT_NE(static_cast<const RdataSet*>(NULL), set);
- EXPECT_EQ(RRType::AAAA(), set->type);
+ EXPECT_EQ(RRType::A(), set->type);
set = set->getNext();
EXPECT_EQ(static_cast<const RdataSet*>(NULL), set);
More information about the bind10-changes
mailing list