From: Otto Moerbeek Date: Fri, 25 Oct 2024 09:17:28 +0000 (+0200) Subject: rename pdns::shuffle to pdns::shufleRecords, as suggested by @rgacogne X-Git-Tag: dnsdist-2.0.0-alpha1~182^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=15b34065882e20932c6f25cd7ce9b7f281e5019e;p=thirdparty%2Fpdns.git rename pdns::shuffle to pdns::shufleRecords, as suggested by @rgacogne --- diff --git a/pdns/recursordist/pdns_recursor.cc b/pdns/recursordist/pdns_recursor.cc index e28d8f6f83..4055aafa73 100644 --- a/pdns/recursordist/pdns_recursor.cc +++ b/pdns/recursordist/pdns_recursor.cc @@ -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); diff --git a/pdns/recursordist/syncres.cc b/pdns/recursordist/syncres.cc index 2681379f20..9202e3a103 100644 --- a/pdns/recursordist/syncres.cc +++ b/pdns/recursordist/syncres.cc @@ -4446,7 +4446,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); } } diff --git a/pdns/recursordist/test-shuffle_cc.cc b/pdns/recursordist/test-shuffle_cc.cc index 469cc2820f..60896b46f1 100644 --- a/pdns/recursordist/test-shuffle_cc.cc +++ b/pdns/recursordist/test-shuffle_cc.cc @@ -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); diff --git a/pdns/shuffle.cc b/pdns/shuffle.cc index 15eee7b6f4..fae7a4a493 100644 --- a/pdns/shuffle.cc +++ b/pdns/shuffle.cc @@ -141,7 +141,7 @@ void pdns::orderAndShuffle(vector& rrs, bool includingAdditionals) shuffle(rrs, includingAdditionals); } -unsigned int pdns::dedup(vector& rrs) +unsigned int pdns::dedupRecords(vector& rrs) { // This function tries to avoid unneccesary work // First a vector with zero or one element does not need dedupping diff --git a/pdns/shuffle.hh b/pdns/shuffle.hh index 6e9b7525b3..e0a7f5ea46 100644 --- a/pdns/shuffle.hh +++ b/pdns/shuffle.hh @@ -29,5 +29,5 @@ namespace pdns { void shuffle(std::vector& rrs); void orderAndShuffle(std::vector& rrs, bool includingAdditionals); -unsigned int dedup(std::vector& rrs); +unsigned int dedupRecords(std::vector& rrs); } diff --git a/pdns/speedtest.cc b/pdns/speedtest.cc index 2c77337bc7..c087bc69f7 100644 --- a/pdns/speedtest.cc +++ b/pdns/speedtest.cc @@ -1213,7 +1213,7 @@ struct DedupRecordsTest } if (d_dedup) { - pdns::dedup(vec); + pdns::dedupRecords(vec); } }