Commit 443cabc1 authored by Michal 'vorner' Vaner's avatar Michal 'vorner' Vaner
Browse files

[2428] Use iequals instead of strncasecmp

It has nicer interface and should be slightly less peculiar.
parent 3fda721e
...@@ -22,10 +22,11 @@ ...@@ -22,10 +22,11 @@
#include <string> #include <string>
#include <memory> #include <memory>
#include <strings.h> #include <boost/algorithm/string/predicate.hpp> // for iequals
using std::string; using std::string;
using std::auto_ptr; using std::auto_ptr;
using boost::algorithm::iequals;
namespace isc { namespace isc {
namespace dns { namespace dns {
...@@ -137,18 +138,13 @@ public: ...@@ -137,18 +138,13 @@ public:
} }
void handleDirective(const char* directive, size_t length) { void handleDirective(const char* directive, size_t length) {
// We use strncasecmp, because there seems to be no reasonable if (iequals(directive, "INCLUDE")) {
// 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) {
doInclude(); doInclude();
} else if (strncasecmp(directive, "ORIGIN", length) == 0) { } else if (iequals(directive, "ORIGIN")) {
// TODO: Implement // TODO: Implement
isc_throw(isc::NotImplemented, isc_throw(isc::NotImplemented,
"Origin directive not implemented yet"); "Origin directive not implemented yet");
} else if (strncasecmp(directive, "TTL", length) == 0) { } else if (iequals(directive, "TTL")) {
// TODO: Implement // TODO: Implement
isc_throw(isc::NotImplemented, isc_throw(isc::NotImplemented,
"TTL directive not implemented yet"); "TTL directive not implemented yet");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment