]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
misc: Use boost::ends_with() in isCanonical instead of open-coding 14984/head
authorUwe Kleine-König <uwe@kleine-koenig.org>
Wed, 18 Dec 2024 09:04:02 +0000 (10:04 +0100)
committerUwe Kleine-König <uwe@kleine-koenig.org>
Tue, 15 Jul 2025 11:12:03 +0000 (13:12 +0200)
boost:ends_with(qname, ".") behaves exactly as isCanonical(qname)
should. So use the first to implement the latter.

pdns/misc.hh

index 2db0a2ec0898778763b39e3e799690ea7aec53f4..3c193f150b82670982eed064f57df68bfe4b36cc 100644 (file)
@@ -484,9 +484,7 @@ pair<string, string> 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)