From b8a86db27a447eeada01e729df6c7e539cf2e14e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Uwe=20Kleine-K=C3=B6nig?= Date: Wed, 18 Dec 2024 10:04:02 +0100 Subject: [PATCH] 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. --- pdns/misc.hh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) 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) -- 2.47.2