From 7fd7a590cfee0f66b22e840f006d67bff9a327bf Mon Sep 17 00:00:00 2001 From: bert hubert Date: Fri, 29 Aug 2014 15:49:40 +0200 Subject: [PATCH] fix in-tree compilation of pdns_recursor (unsupported) plus improve case insensitive compare helper --- pdns/Makefile.am | 3 ++- pdns/misc.hh | 8 ++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/pdns/Makefile.am b/pdns/Makefile.am index a1d723636..7334fed3f 100644 --- a/pdns/Makefile.am +++ b/pdns/Makefile.am @@ -339,7 +339,8 @@ dns_random.cc \ lua-pdns.cc lua-pdns.hh lua-recursor.cc lua-recursor.hh randomhelper.cc \ recpacketcache.cc recpacketcache.hh dns.cc nsecrecords.cc base32.cc cachecleaner.hh \ ws-recursor.cc ws-recursor.hh ws-api.cc ws-api.hh webserver.cc webserver.hh \ -json.cc json.hh version.hh version.cc responsestats.cc rec-carbon.cc +json.cc json.hh version.hh version.cc responsestats.cc rec-carbon.cc ext/yahttp/yahttp/reqresp.cpp \ +ext/yahttp/yahttp/router.cpp pdns_recursor_LDFLAGS= $(LUA_LIBS) pdns_recursor_LDADD= $(POLARSSL_LIBS) $(YAHTTP_LIBS) diff --git a/pdns/misc.hh b/pdns/misc.hh index a503f8da6..81291a374 100644 --- a/pdns/misc.hh +++ b/pdns/misc.hh @@ -311,16 +311,16 @@ inline bool pdns_ilexicographical_compare(const std::string& a, const std::strin inline bool pdns_ilexicographical_compare(const std::string& a, const std::string& b) { const unsigned char *aPtr = (const unsigned char*)a.c_str(), *bPtr = (const unsigned char*)b.c_str(); - - while(*aPtr && *bPtr) { + const unsigned char *aEptr = aPtr + a.length(), *bEptr = bPtr + b.length(); + while(aPtr != aEptr && bPtr != bEptr) { if ((*aPtr != *bPtr) && (dns_tolower(*aPtr) - dns_tolower(*bPtr))) return (dns_tolower(*aPtr) - dns_tolower(*bPtr)) < 0; aPtr++; bPtr++; } - if(!*aPtr && !*bPtr) // strings are equal (in length) + if(aPtr == aEptr && bPtr == bEptr) // strings are equal (in length) return false; - return !*aPtr; // true if first string was shorter + return aPtr == aEptr; // true if first string was shorter } inline bool pdns_iequals(const std::string& a, const std::string& b) __attribute__((pure)); -- 2.49.0