From: Michal 'vorner' Vaner Date: Thu, 14 Jun 2012 12:35:20 +0000 (+0200) Subject: [1975] Remove matched_labels from the result X-Git-Tag: trac2351_base~97^2~9^2~4^2~3 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b66ca2c6cc969be893e40184de90e12a33602b67;p=thirdparty%2Fkea.git [1975] Remove matched_labels from the result They are likely not to be useful anyway and this allows a small optimisation. --- diff --git a/src/lib/datasrc/list.cc b/src/lib/datasrc/list.cc index acfaf9606b..f9a95ab42e 100644 --- a/src/lib/datasrc/list.cc +++ b/src/lib/datasrc/list.cc @@ -81,7 +81,7 @@ ConfigurableClientList::find(const dns::Name& name, bool want_exact_match, operator FindResult() const { // Conversion to the right result. If we return this, there was // a partial match at best. - return (FindResult(datasrc_client, finder, matched_labels, false)); + return (FindResult(datasrc_client, finder, false)); } } candidate; @@ -102,7 +102,7 @@ ConfigurableClientList::find(const dns::Name& name, bool want_exact_match, // TODO: In case we have only the datasource and not the finder // and the need_updater parameter is true, get the zone there. return (FindResult(info.data_src_client_, result.zone_finder, - name.getLabelCount(), true)); + true)); } case result::PARTIALMATCH: { if (!want_exact_match) { diff --git a/src/lib/datasrc/list.h b/src/lib/datasrc/list.h index 0033d7192a..7cb9e376d3 100644 --- a/src/lib/datasrc/list.h +++ b/src/lib/datasrc/list.h @@ -65,22 +65,19 @@ public: /// /// It simply fills in the member variables according to the /// parameters. See the member descriptions for their meaning. - FindResult(DataSourceClient* dsrc_client, - const ZoneFinderPtr& finder, - uint8_t matched_labels, bool exact_match) : + FindResult(DataSourceClient* dsrc_client, const ZoneFinderPtr& finder, + bool exact_match) : dsrc_client_(dsrc_client), finder_(finder), - matched_labels_(matched_labels), exact_match_(exact_match) { } /// \brief Negative answer constructor. /// /// This conscructs a result for negative answer. Both pointers are - /// NULL, matched_labels_ is 0 and exact_match_ is false. + /// NULL, and exact_match_ is false. FindResult() : dsrc_client_(NULL), - matched_labels_(0), exact_match_(false) { } @@ -91,7 +88,6 @@ public: bool operator ==(const FindResult& other) const { return (dsrc_client_ == other.dsrc_client_ && finder_ == other.finder_ && - matched_labels_ == other.matched_labels_ && exact_match_ == other.exact_match_); } @@ -114,12 +110,6 @@ public: /// \see find const ZoneFinderPtr finder_; - /// \brief Number of matching labels. - /// - /// The number of labels the result have in common with the queried - /// name of zone. - const uint8_t matched_labels_; - /// \brief If the result is an exact match. const bool exact_match_; }; diff --git a/src/lib/datasrc/tests/list_unittest.cc b/src/lib/datasrc/tests/list_unittest.cc index ca07d67632..a0773b154a 100644 --- a/src/lib/datasrc/tests/list_unittest.cc +++ b/src/lib/datasrc/tests/list_unittest.cc @@ -191,7 +191,6 @@ public: EXPECT_EQ(dsrc.get(), result.dsrc_client_); ASSERT_NE(ZoneFinderPtr(), result.finder_); EXPECT_EQ(name, result.finder_->getOrigin()); - EXPECT_EQ(name.getLabelCount(), result.matched_labels_); EXPECT_EQ(exact, result.exact_match_); } // Configure the list with multiple data sources, according to