From: Uwe Kleine-König Date: Wed, 18 Dec 2024 09:04:02 +0000 (+0100) Subject: misc: Use boost::ends_with() in isCanonical instead of open-coding X-Git-Tag: rec-5.4.0-alpha0~33^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F14984%2Fhead;p=thirdparty%2Fpdns.git misc: Use boost::ends_with() in isCanonical instead of open-coding boost:ends_with(qname, ".") behaves exactly as isCanonical(qname) should. So use the first to implement the latter. --- diff --git a/pdns/misc.hh b/pdns/misc.hh index 2db0a2ec08..3c193f150b 100644 --- a/pdns/misc.hh +++ b/pdns/misc.hh @@ -484,9 +484,7 @@ pair splitField(const string& inp, char sepa); inline bool isCanonical(std::string_view qname) { - if(qname.empty()) - return false; - return qname[qname.size()-1]=='.'; + return boost::ends_with(qname, "."); } inline DNSName toCanonic(const ZoneName& zone, const string& qname)