28 #if defined(HAVE_STRCASECMP) || defined (HAVE_STRNCASECMP)
32 #if defined(HAVE_STRICMP) || defined (HAVE_STRNICMP)
46 inline bool casecompare(
char c1,
char c2) {
return (tolower(c1) == tolower(c2)); }
53 inline bool equal(
const std::string& s1,
const std::string& s2)
55 return s1.size() == s2.size()
56 && std::equal(s1.begin(), s1.end(), s2.begin(), casecompare);
64 inline bool equal(
const char* s1,
const char* s2)
66 #if defined(HAVE_STRCASECMP)
67 return strcasecmp(s1, s2) == 0;
68 #elif defined(HAVE_STRICMP)
69 return stricmp(s1, s2) == 0;
74 if (s1 == 0 || s2 == 0)
77 while ((*s1 !=
'\0') || (*s2 !=
'\0'))
79 if (!casecompare(*s1, *s2))
94 inline bool equal(
const char* s1,
const char* s2,
size_t n)
96 #if defined(HAVE_STRNCASECMP)
97 return strncasecmp(s1, s2, n) == 0;
98 #elif defined(HAVE_STRNICMP)
99 return strnicmp(s1, s2, n) == 0;
101 if (s1 == s2 || n == 0)
104 if (s1 == 0 || s2 == 0)
107 while (n-- && ((*s1 !=
'\0') || (*s2 !=
'\0')))
109 if (!casecompare(*s1, *s2))