summaryrefslogtreecommitdiff
path: root/src/ranked_match.cc
diff options
context:
space:
mode:
authorMaxime Coste <frrrwww@gmail.com>2016-05-11 09:49:45 +0100
committerMaxime Coste <frrrwww@gmail.com>2016-05-11 09:49:45 +0100
commit84f62e6ff2e1ac37e412ddf7c06d3ceb985e2ee3 (patch)
treef9f8ceb992f094ce3e64a110f56ae7ad2d62225c /src/ranked_match.cc
parent6b1bd84e8e2bc84101bd2370c655223ef0a13d1d (diff)
Use C++ locale based functions instead of the libc ones
Diffstat (limited to 'src/ranked_match.cc')
-rw-r--r--src/ranked_match.cc7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/ranked_match.cc b/src/ranked_match.cc
index 89eb2c85..6aa89e52 100644
--- a/src/ranked_match.cc
+++ b/src/ranked_match.cc
@@ -34,6 +34,7 @@ using Utf8It = utf8::iterator<const char*>;
static int count_word_boundaries_match(StringView candidate, StringView query)
{
+ std::locale locale;
int count = 0;
Utf8It query_it{query.begin(), query};
Codepoint prev = 0;
@@ -41,8 +42,10 @@ static int count_word_boundaries_match(StringView candidate, StringView query)
{
const Codepoint c = *it;
const bool is_word_boundary = prev == 0 or
- (!iswalnum(prev) and iswalnum(c)) or
- (islower(prev) and isupper(c));
+ (!std::isalnum((wchar_t)prev, locale) and
+ std::isalnum((wchar_t)c, locale)) or
+ (std::islower((wchar_t)prev, locale) and
+ std::isupper((wchar_t)c, locale));
prev = c;
if (not is_word_boundary)