From f1ae49f7c05ebfedd3130f349c8a5eca6ddbdfd2 Mon Sep 17 00:00:00 2001 From: bert hubert Date: Thu, 11 Feb 2016 11:37:24 +0100 Subject: [PATCH] liberate getAddr() helper from sortlist.cc for wider use --- pdns/dnsrecords.cc | 10 ++++++++++ pdns/dnsrecords.hh | 2 +- pdns/sortlist.cc | 8 -------- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/pdns/dnsrecords.cc b/pdns/dnsrecords.cc index 9bf357e32..a2775bdbe 100644 --- a/pdns/dnsrecords.cc +++ b/pdns/dnsrecords.cc @@ -608,6 +608,16 @@ void reportAllTypes() reportOtherTypes(); } +ComboAddress getAddr(const DNSRecord& dr, uint16_t defport) +{ + if(auto addr=getRR(dr)) { + return addr->getCA(defport); + } + else + return getRR(dr)->getCA(defport); +} + + #if 0 static struct Reporter { diff --git a/pdns/dnsrecords.hh b/pdns/dnsrecords.hh index 0cdff09b8..91df95aab 100644 --- a/pdns/dnsrecords.hh +++ b/pdns/dnsrecords.hh @@ -708,5 +708,5 @@ DNSRecord makeOpt(int udpsize, int extRCode, int Z); void reportBasicTypes(); void reportOtherTypes(); void reportAllTypes(); - +ComboAddress getAddr(const DNSRecord& dr, uint16_t defport=0); #endif diff --git a/pdns/sortlist.cc b/pdns/sortlist.cc index 4a014f04d..f840844f0 100644 --- a/pdns/sortlist.cc +++ b/pdns/sortlist.cc @@ -52,14 +52,6 @@ bool SortListOrderCmp::operator()(const ComboAddress& a, const ComboAddress& b) return aOrder < bOrder; } -static ComboAddress getAddr(const DNSRecord& dr) -{ - if(auto addr=getRR(dr)) { - return addr->getCA(); - } - else - return getRR(dr)->getCA(); -} bool SortListOrderCmp::operator()(const DNSRecord& ar, const DNSRecord& br) const { if(ar.d_type < br.d_type) -- 2.40.0