Skip to content

Commit

Permalink
rename pdns::shuffle to pdns::shufleRecords, as suggested by @rgacogne
Browse files Browse the repository at this point in the history
  • Loading branch information
omoerbeek committed Oct 25, 2024
1 parent 5a98b0f commit 2e9888c
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion pdns/recursordist/pdns_recursor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1509,7 +1509,7 @@ void startDoResolve(void* arg) // NOLINT(readability-function-cognitive-complexi
}

if (!ret.empty()) {
pdns::dedup(ret);
pdns::dedupRecords(ret);
pdns::orderAndShuffle(ret, false);
if (auto listToSort = luaconfsLocal->sortlist.getOrderCmp(comboWriter->d_source)) {
stable_sort(ret.begin(), ret.end(), *listToSort);
Expand Down
2 changes: 1 addition & 1 deletion pdns/recursordist/syncres.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4435,7 +4435,7 @@ void SyncRes::sanitizeRecordsPass2(const std::string& prefix, LWResult& lwr, con
}
lwr.d_records = std::move(vec);
}
if (auto count = pdns::dedup(lwr.d_records); count > 0) {
if (auto count = pdns::dedupRecords(lwr.d_records); count > 0) {
LOG(prefix << qname << ": Removed " << count << " duplicate records from response received from " << auth << endl);
}
}
Expand Down
6 changes: 3 additions & 3 deletions pdns/recursordist/test-shuffle_cc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,16 @@ BOOST_AUTO_TEST_CASE(test_simple)
auto* address = &list;
addRecordToList(list, DNSName("foo"), QType::A, "1.2.3.4");
addRecordToList(list, DNSName("foo2"), QType::A, "1.2.3.4");
auto dups = pdns::dedup(list);
auto dups = pdns::dedupRecords(list);
BOOST_CHECK_EQUAL(dups, 0U);
BOOST_CHECK_EQUAL(list.size(), 2U);
addRecordToList(list, DNSName("foo"), QType::A, "1.2.3.4");
dups = pdns::dedup(list);
dups = pdns::dedupRecords(list);
BOOST_CHECK_EQUAL(dups, 1U);
BOOST_CHECK_EQUAL(list.size(), 2U);
addRecordToList(list, DNSName("Foo"), QType::A, "1.2.3.4");
addRecordToList(list, DNSName("FoO"), QType::A, "1.2.3.4", DNSResourceRecord::ADDITIONAL, 999);
dups = pdns::dedup(list);
dups = pdns::dedupRecords(list);
BOOST_CHECK_EQUAL(dups, 2U);
BOOST_CHECK_EQUAL(list.size(), 2U);
BOOST_CHECK_EQUAL(address, &list);
Expand Down
2 changes: 1 addition & 1 deletion pdns/shuffle.cc
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ void pdns::orderAndShuffle(vector<DNSRecord>& rrs, bool includingAdditionals)
shuffle(rrs, includingAdditionals);
}

unsigned int pdns::dedup(vector<DNSRecord>& rrs)
unsigned int pdns::dedupRecords(vector<DNSRecord>& rrs)
{
// This function tries to avoid unneccesary work
// First a vector with zero or one element does not need dedupping
Expand Down
2 changes: 1 addition & 1 deletion pdns/shuffle.hh
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@ namespace pdns
{
void shuffle(std::vector<DNSZoneRecord>& rrs);
void orderAndShuffle(std::vector<DNSRecord>& rrs, bool includingAdditionals);
unsigned int dedup(std::vector<DNSRecord>& rrs);
unsigned int dedupRecords(std::vector<DNSRecord>& rrs);
}
2 changes: 1 addition & 1 deletion pdns/speedtest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1213,7 +1213,7 @@ struct DedupRecordsTest
}

if (d_dedup) {
pdns::dedup(vec);
pdns::dedupRecords(vec);
}
}

Expand Down

0 comments on commit 2e9888c

Please sign in to comment.