summaryrefslogtreecommitdiff
path: root/src/core/wee-config.c
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2022-12-21 19:23:29 +0100
committerSébastien Helleu <flashcode@flashtux.org>2022-12-21 20:49:09 +0100
commit68b510517e7a14b2d2457f8437e9291b87e0d1d5 (patch)
treea3fae5b8673ec860f49315bb1b0ec72e74cf54d1 /src/core/wee-config.c
parent95286c1eb362cedb767597ea23fb29d6455f6b94 (diff)
downloadweechat-68b510517e7a14b2d2457f8437e9291b87e0d1d5.zip
core: improve case convert and insensitive char comparisons (closes #258)
All lowercase letters are now properly converted to uppercase letters (and vice versa), via functions `towupper` and `towlower`. Functions `string_tolower`, `string_toupper` and `utf8_charcasecmp` have been optimized to be faster when there are ASCII chars (< 128); functions are about 25-40% faster with mixed chars (both ASCII and multi-bytes). Function `utf8_wide_char` has been removed, `utf8_char_int` can be used instead.
Diffstat (limited to 'src/core/wee-config.c')
-rw-r--r--src/core/wee-config.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/core/wee-config.c b/src/core/wee-config.c
index c5bb8cd3f..f84c49626 100644
--- a/src/core/wee-config.c
+++ b/src/core/wee-config.c
@@ -500,7 +500,7 @@ config_set_word_chars (const char *str_word_chars,
/* char1 */
item = string_strndup (ptr_item, pos - ptr_item);
item2 = string_convert_escaped_chars (item);
- (*word_chars)[i].char1 = utf8_wide_char (item2);
+ (*word_chars)[i].char1 = utf8_char_int (item2);
if (item)
free (item);
if (item2)
@@ -508,7 +508,7 @@ config_set_word_chars (const char *str_word_chars,
/* char2 */
item = strdup (pos + 1);
item2 = string_convert_escaped_chars (item);
- (*word_chars)[i].char2 = utf8_wide_char (item2);
+ (*word_chars)[i].char2 = utf8_char_int (item2);
if (item)
free (item);
if (item2)
@@ -521,7 +521,7 @@ config_set_word_chars (const char *str_word_chars,
if ((*word_chars)[i].wc_class == (wctype_t)0)
{
item = string_convert_escaped_chars (ptr_item);
- (*word_chars)[i].char1 = utf8_wide_char (item);
+ (*word_chars)[i].char1 = utf8_char_int (item);
(*word_chars)[i].char2 = (*word_chars)[i].char1;
if (item)
free (item);