Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/dosbox-staging/dosbox-staging.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkcgen <kcgen@users.noreply.github.com>2022-10-12 18:44:05 +0300
committerkcgen <kcgen@users.noreply.github.com>2022-10-12 18:50:55 +0300
commitfacf2095f632ffe219b19b03e376bd872fb7b496 (patch)
tree2e8fc3f362fb46e63370769eee6fb75daebf84aa
parentfe5973dddc18638d5c6b2a96e86fdf3a9deeecfa (diff)
Shorten case-insensitive char and string equality functions
-rw-r--r--include/string_utils.h4
-rw-r--r--src/dos/dos_keyboard_layout.cpp4
-rw-r--r--src/misc/string_utils.cpp6
3 files changed, 7 insertions, 7 deletions
diff --git a/include/string_utils.h b/include/string_utils.h
index e4e7b25cb..6f52c5698 100644
--- a/include/string_utils.h
+++ b/include/string_utils.h
@@ -155,8 +155,8 @@ inline bool is_empty(const char *str) noexcept
}
// case-insensitive comparisons
-bool char_iequals(const char a, const char b);
-bool string_iequals(const std::string &a, const std::string &b);
+bool ciequals(const char a, const char b);
+bool iequals(const std::string &a, const std::string &b);
char *strip_word(char *&cmd);
diff --git a/src/dos/dos_keyboard_layout.cpp b/src/dos/dos_keyboard_layout.cpp
index 6bbf7f961..1ebaa99fc 100644
--- a/src/dos/dos_keyboard_layout.cpp
+++ b/src/dos/dos_keyboard_layout.cpp
@@ -1071,7 +1071,7 @@ KeyboardErrorCode KeyboardLayout::ReadCodePageFile(const char *requested_cp_file
bool KeyboardLayout::HasLanguageCode(const char *requested_code)
{
for (const auto &language_code : language_codes)
- if (string_iequals(language_code, requested_code))
+ if (iequals(language_code, requested_code))
return true;
return false;
}
@@ -1082,7 +1082,7 @@ KeyboardErrorCode KeyboardLayout::SwitchKeyboardLayout(const char *new_layout,
{
assert(new_layout);
- if (!string_iequals(new_layout, "US")) {
+ if (!iequals(new_layout, "US")) {
// switch to a foreign layout
if (HasLanguageCode(new_layout)) {
diff --git a/src/misc/string_utils.cpp b/src/misc/string_utils.cpp
index 535acbc37..717c1f9ba 100644
--- a/src/misc/string_utils.cpp
+++ b/src/misc/string_utils.cpp
@@ -179,14 +179,14 @@ std::vector<std::string> split(const std::string &seq)
return words;
}
-bool char_iequals(const char a, const char b)
+bool ciequals(const char a, const char b)
{
return tolower(a) == tolower(b);
}
-bool string_iequals(const std::string &a, const std::string &b)
+bool iequals(const std::string &a, const std::string &b)
{
- return std::equal(a.begin(), a.end(), b.begin(), b.end(), char_iequals);
+ return std::equal(a.begin(), a.end(), b.begin(), b.end(), ciequals);
}
char *strip_word(char *&line)