From a3db4128bc18c09cddf8b03cb3e908a2815d3216 Mon Sep 17 00:00:00 2001 From: Aaron Gyes Date: Sun, 22 Sep 2019 15:46:39 -0700 Subject: [PATCH] use std::tolower --- src/builtin_string.cpp | 4 ++-- src/expand.h | 4 ++-- src/history.cpp | 3 ++- src/wcstringutil.cpp | 8 -------- src/wcstringutil.h | 3 --- 5 files changed, 6 insertions(+), 16 deletions(-) diff --git a/src/builtin_string.cpp b/src/builtin_string.cpp index 3b4b17b6a..ef544c7da 100644 --- a/src/builtin_string.cpp +++ b/src/builtin_string.cpp @@ -633,7 +633,7 @@ class wildcard_matcher_t : public string_matcher_t { io_streams_t &streams) : string_matcher_t(opts, streams), wcpattern(parse_util_unescape_wildcards(pattern)) { if (opts.ignore_case) { - wcpattern = wcstolower(std::move(wcpattern)); + wcpattern = std::tolower(std::move(wcpattern)); } if (opts.entire) { if (!wcpattern.empty()) { @@ -654,7 +654,7 @@ class wildcard_matcher_t : public string_matcher_t { bool match; if (opts.ignore_case) { - match = wildcard_match(wcstolower(arg), wcpattern, false); + match = wildcard_match(std::tolower(arg), wcpattern, false); } else { match = wildcard_match(arg, wcpattern, false); } diff --git a/src/expand.h b/src/expand.h index 371724307..40d4832c1 100644 --- a/src/expand.h +++ b/src/expand.h @@ -79,9 +79,9 @@ enum : wchar_t { VARIABLE_EXPAND, /// Character representing variable expansion into a single element. VARIABLE_EXPAND_SINGLE, - /// Character representing the start of a bracket expansion. + /// Character representing the start of a brace expansion. BRACE_BEGIN, - /// Character representing the end of a bracket expansion. + /// Character representing the end of a brace expansion. BRACE_END, /// Character representing separation between two bracket elements. BRACE_SEP, diff --git a/src/history.cpp b/src/history.cpp index ea2bb5c1c..182e0b3b3 100644 --- a/src/history.cpp +++ b/src/history.cpp @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -180,7 +181,7 @@ bool history_item_t::matches_search(const wcstring &term, enum history_search_ty // search object if we're doing a case insensitive search. wcstring contents_lower; if (!case_sensitive) { - contents_lower = wcstolower(contents); + contents_lower = std::tolower(contents); } const wcstring &content_to_match = case_sensitive ? contents : contents_lower; diff --git a/src/wcstringutil.cpp b/src/wcstringutil.cpp index 3691f79e5..ea5f8b9a9 100644 --- a/src/wcstringutil.cpp +++ b/src/wcstringutil.cpp @@ -4,8 +4,6 @@ #include "common.h" #include "wcstringutil.h" -#include - typedef wcstring::size_type size_type; wcstring_range wcstring_tok(wcstring &str, const wcstring &needle, wcstring_range last) { @@ -64,9 +62,3 @@ wcstring trim(wcstring input, const wchar_t *any_of) { result.erase(0, prefix); return result; } - -wcstring wcstolower(wcstring input) { - wcstring result = std::move(input); - std::transform(result.begin(), result.end(), result.begin(), towlower); - return result; -} diff --git a/src/wcstringutil.h b/src/wcstringutil.h index 54ce9ba2a..ee884b857 100644 --- a/src/wcstringutil.h +++ b/src/wcstringutil.h @@ -68,7 +68,4 @@ wcstring truncate(const wcstring &input, int max_len, wcstring trim(wcstring input); wcstring trim(wcstring input, const wchar_t *any_of); -/// Converts a string to lowercase. -wcstring wcstolower(wcstring input); - #endif