From: Michal 'vorner' Vaner Date: Wed, 12 Dec 2012 09:43:57 +0000 (+0100) Subject: [2428] Use iequals instead of strncasecmp X-Git-Tag: bind10-1.0.0-beta-release~24^2~4 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=443cabc1e4a305f19b39bcbdb66c0bde010c93ae;p=thirdparty%2Fkea.git [2428] Use iequals instead of strncasecmp It has nicer interface and should be slightly less peculiar. --- diff --git a/src/lib/dns/master_loader.cc b/src/lib/dns/master_loader.cc index da12013b54..f31d9bfc09 100644 --- a/src/lib/dns/master_loader.cc +++ b/src/lib/dns/master_loader.cc @@ -22,10 +22,11 @@ #include #include -#include +#include // for iequals using std::string; using std::auto_ptr; +using boost::algorithm::iequals; namespace isc { namespace dns { @@ -137,18 +138,13 @@ public: } void handleDirective(const char* directive, size_t length) { - // We use strncasecmp, because there seems to be no reasonable - // way to compare strings case-insensitive in C++ - - // Warning: The order of compared strings does matter. The length - // parameter applies to the first one only. - if (strncasecmp(directive, "INCLUDE", length) == 0) { + if (iequals(directive, "INCLUDE")) { doInclude(); - } else if (strncasecmp(directive, "ORIGIN", length) == 0) { + } else if (iequals(directive, "ORIGIN")) { // TODO: Implement isc_throw(isc::NotImplemented, "Origin directive not implemented yet"); - } else if (strncasecmp(directive, "TTL", length) == 0) { + } else if (iequals(directive, "TTL")) { // TODO: Implement isc_throw(isc::NotImplemented, "TTL directive not implemented yet");