30#elif defined(HAVE_STRCASECMP) || defined (HAVE_STRNCASECMP)
44 inline bool casecompare(
char c1,
char c2) {
return (tolower(c1) == tolower(c2)); }
51 inline bool equal(
const std::string& s1,
const std::string& s2)
53 return s1.size() == s2.size()
54 && std::equal(s1.begin(), s1.end(), s2.begin(), casecompare);
62 inline bool equal(
const char* s1,
const char* s2)
65 return _stricmp(s1, s2) == 0;
66#elif defined(HAVE_STRCASECMP)
67 return strcasecmp(s1, s2) == 0;
72 if (s1 == 0 || s2 == 0)
75 while ((*s1 !=
'\0') || (*s2 !=
'\0'))
77 if (!casecompare(*s1, *s2))
92 inline bool equal(
const char* s1,
const char* s2,
size_t n)
95 return _strnicmp(s1, s2, n) == 0;
96#elif defined(HAVE_STRNCASECMP)
97 return strncasecmp(s1, s2, n) == 0;
99 if (s1 == s2 || n == 0)
102 if (s1 == 0 || s2 == 0)
105 while (n-- && ((*s1 !=
'\0') || (*s2 !=
'\0')))
107 if (!casecompare(*s1, *s2))