From 5f8af391b1ba7a49c884a020b525fa5ef8ff6db5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?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 39fdb6c08680..2a7c0be2a2bf 100644 --- a/pdns/misc.hh +++ b/pdns/misc.hh @@ -469,9 +469,7 @@ pair splitField(const string& inp, char sepa); inline bool isCanonical(const string& qname) { - if(qname.empty()) - return false; - return qname[qname.size()-1]=='.'; + return boost::ends_with(qname, "."); } inline DNSName toCanonic(const DNSName& zone, const string& qname)