use std::tolower

This commit is contained in:
Aaron Gyes 2019-09-22 15:46:39 -07:00
parent a19d9b2e73
commit a3db4128bc
5 changed files with 6 additions and 16 deletions

View File

@ -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);
}

View File

@ -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,

View File

@ -22,6 +22,7 @@
#include <cwchar>
#include <functional>
#include <iterator>
#include <locale>
#include <map>
#include <numeric>
#include <type_traits>
@ -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;

View File

@ -4,8 +4,6 @@
#include "common.h"
#include "wcstringutil.h"
#include <wctype.h>
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;
}

View File

@ -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