aboutsummaryrefslogtreecommitdiff
path: root/libbutl
diff options
context:
space:
mode:
Diffstat (limited to 'libbutl')
-rw-r--r--libbutl/curl.cxx8
-rw-r--r--libbutl/process.cxx16
-rw-r--r--libbutl/project-name.cxx2
-rw-r--r--libbutl/project-name.mxx4
-rw-r--r--libbutl/utility.ixx12
-rw-r--r--libbutl/utility.mxx20
6 files changed, 30 insertions, 32 deletions
diff --git a/libbutl/curl.cxx b/libbutl/curl.cxx
index f88869b..33ca5be 100644
--- a/libbutl/curl.cxx
+++ b/libbutl/curl.cxx
@@ -33,7 +33,7 @@ import butl.fdstream;
import butl.small_vector;
#endif
-import butl.utility; // casecmp()
+import butl.utility; // icasecmp()
#else
#include <libbutl/utility.mxx>
#endif
@@ -178,8 +178,7 @@ namespace butl
if (n == string::npos)
throw invalid_argument ("no protocol in URL");
- if (casecmp (u, "ftp", n) == 0 ||
- casecmp (u, "tftp", n) == 0)
+ if (icasecmp (u, "ftp", n) == 0 || icasecmp (u, "tftp", n) == 0)
{
switch (m)
{
@@ -189,8 +188,7 @@ namespace butl
throw invalid_argument ("POST method with FTP protocol");
}
}
- else if (casecmp (u, "http", n) == 0 ||
- casecmp (u, "https", n) == 0)
+ else if (icasecmp (u, "http", n) == 0 || icasecmp (u, "https", n) == 0)
{
o.push_back ("--fail"); // Fail on HTTP errors (e.g., 404).
o.push_back ("--location"); // Follow redirects.
diff --git a/libbutl/process.cxx b/libbutl/process.cxx
index 4408610..b82af3c 100644
--- a/libbutl/process.cxx
+++ b/libbutl/process.cxx
@@ -135,7 +135,7 @@ import butl.small_vector;
import std.threading;
#endif
-import butl.utility; // casecmp()
+import butl.utility; // icasecmp()
import butl.fdstream; // fdnull()
#else
#include <libbutl/utility.mxx>
@@ -945,9 +945,9 @@ namespace butl
{
const char* e (traits::find_extension (f, fn));
ext = (e == nullptr ||
- (casecmp (e, ".exe") != 0 &&
- casecmp (e, ".bat") != 0 &&
- casecmp (e, ".cmd") != 0));
+ (icasecmp (e, ".exe") != 0 &&
+ icasecmp (e, ".bat") != 0 &&
+ icasecmp (e, ".cmd") != 0));
}
process_path r (f, path (), path ()); // Make sure it is not empty.
@@ -1413,7 +1413,7 @@ namespace butl
for (; *ev != nullptr; ++ev)
{
const char* v (*ev);
- if (casecmp (cv, v, nn) == 0 && (v[nn] == '=' || v[nn] == '\0'))
+ if (icasecmp (cv, v, nn) == 0 && (v[nn] == '=' || v[nn] == '\0'))
break;
}
@@ -1443,8 +1443,8 @@ namespace butl
{
const char* p (pp.effect_string ());
const char* e (path::traits_type::find_extension (p));
- if (e != nullptr && (casecmp (e, ".bat") == 0 ||
- casecmp (e, ".cmd") == 0))
+ if (e != nullptr && (icasecmp (e, ".bat") == 0 ||
+ icasecmp (e, ".cmd") == 0))
{
batch = getenv ("COMSPEC");
@@ -1749,7 +1749,7 @@ namespace butl
{
if (auto name = static_cast<const char*> (rva_to_ptr (imp->Name)))
{
- if (casecmp (name, "msys-2.0.dll") == 0)
+ if (icasecmp (name, "msys-2.0.dll") == 0)
return true;
}
}
diff --git a/libbutl/project-name.cxx b/libbutl/project-name.cxx
index a1767e9..4b02949 100644
--- a/libbutl/project-name.cxx
+++ b/libbutl/project-name.cxx
@@ -88,7 +88,7 @@ namespace butl
if (e != nullptr &&
p != string::npos &&
- casecmp (value_.c_str () + p + 1, e) != 0)
+ icasecmp (value_.c_str () + p + 1, e) != 0)
p = string::npos;
return string (value_, 0, p);
diff --git a/libbutl/project-name.mxx b/libbutl/project-name.mxx
index 5f5a586..dce1c7a 100644
--- a/libbutl/project-name.mxx
+++ b/libbutl/project-name.mxx
@@ -22,7 +22,7 @@ export module butl.project_name;
import std.core;
import std.io;
#endif
-import butl.utility; // casecmp(), sanitize_identifier()
+import butl.utility; // icasecmp(), sanitize_identifier()
#else
#include <libbutl/utility.mxx>
#endif
@@ -100,7 +100,7 @@ LIBBUTL_MODEXPORT namespace butl
//
int compare (const project_name& n) const {return compare (n.value_);}
int compare (const std::string& n) const {return compare (n.c_str ());}
- int compare (const char* n) const {return butl::casecmp (value_, n);}
+ int compare (const char* n) const {return icasecmp (value_, n);}
private:
std::string value_;
diff --git a/libbutl/utility.ixx b/libbutl/utility.ixx
index 8f37242..d8a5ee8 100644
--- a/libbutl/utility.ixx
+++ b/libbutl/utility.ixx
@@ -84,7 +84,7 @@ namespace butl
}
inline int
- casecmp (char l, char r)
+ icasecmp (char l, char r)
{
l = lcase (l);
r = lcase (r);
@@ -92,7 +92,7 @@ namespace butl
}
inline int
- casecmp (const char* l, const char* r, std::size_t n)
+ icasecmp (const char* l, const char* r, std::size_t n)
{
#ifndef _WIN32
return n == std::string::npos ? strcasecmp (l, r) : strncasecmp (l, r, n);
@@ -102,15 +102,15 @@ namespace butl
}
inline int
- casecmp (const std::string& l, const std::string& r, std::size_t n)
+ icasecmp (const std::string& l, const std::string& r, std::size_t n)
{
- return casecmp (l.c_str (), r.c_str (), n);
+ return icasecmp (l.c_str (), r.c_str (), n);
}
inline int
- casecmp (const std::string& l, const char* r, std::size_t n)
+ icasecmp (const std::string& l, const char* r, std::size_t n)
{
- return casecmp (l.c_str (), r, n);
+ return icasecmp (l.c_str (), r, n);
}
inline bool
diff --git a/libbutl/utility.mxx b/libbutl/utility.mxx
index 03fb89e..11aa013 100644
--- a/libbutl/utility.mxx
+++ b/libbutl/utility.mxx
@@ -108,31 +108,31 @@ LIBBUTL_MODEXPORT namespace butl
// The optional size argument specifies the maximum number of characters
// to compare.
//
- int casecmp (char, char);
+ int icasecmp (char, char);
- int casecmp (const std::string&, const std::string&,
- std::size_t = std::string::npos);
+ int icasecmp (const std::string&, const std::string&,
+ std::size_t = std::string::npos);
- int casecmp (const std::string&, const char*,
- std::size_t = std::string::npos);
+ int icasecmp (const std::string&, const char*,
+ std::size_t = std::string::npos);
- int casecmp (const char*, const char*, std::size_t = std::string::npos);
+ int icasecmp (const char*, const char*, std::size_t = std::string::npos);
// Case-insensitive key comparators (i.e., to be used in sets, maps, etc).
//
- struct case_compare_string
+ struct icase_compare_string
{
bool operator() (const std::string& x, const std::string& y) const
{
- return casecmp (x, y) < 0;
+ return icasecmp (x, y) < 0;
}
};
- struct case_compare_c_string
+ struct icase_compare_c_string
{
bool operator() (const char* x, const char* y) const
{
- return casecmp (x, y) < 0;
+ return icasecmp (x, y) < 0;
}
};