summaryrefslogtreecommitdiff
path: root/src/core/wee-utf8.c
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2022-12-24 17:33:22 +0100
committerSébastien Helleu <flashcode@flashtux.org>2022-12-24 17:33:22 +0100
commita67556907d739bbe6db5110e46d581165fd41c64 (patch)
tree2f90c27b4685f25235560f6e1c66543a63075bb0 /src/core/wee-utf8.c
parent083032972dc75ffde841ac77dce4d49093c9ead7 (diff)
downloadweechat-a67556907d739bbe6db5110e46d581165fd41c64.zip
api: rename char comparison functions "utf8_char*" to "string_char*"
Diffstat (limited to 'src/core/wee-utf8.c')
-rw-r--r--src/core/wee-utf8.c91
1 files changed, 0 insertions, 91 deletions
diff --git a/src/core/wee-utf8.c b/src/core/wee-utf8.c
index 557fc592d..0cb78405f 100644
--- a/src/core/wee-utf8.c
+++ b/src/core/wee-utf8.c
@@ -529,97 +529,6 @@ utf8_strlen_screen (const char *string)
}
/*
- * Compares two UTF-8 chars (case sensitive).
- *
- * Returns: arithmetic result of subtracting the first char in string2
- * from the first char in string1:
- * < 0: string1 < string2
- * 0: string1 == string2
- * > 0: string1 > string2
- */
-
-int
-utf8_charcmp (const char *string1, const char *string2)
-{
- return utf8_char_int (string1) - utf8_char_int (string2);
-}
-
-/*
- * Compares two UTF-8 chars (case insensitive).
- *
- * Returns: arithmetic result of subtracting the first char in string2
- * (converted to lowercase) from the first char in string1 (converted
- * to lowercase):
- * < 0: string1 < string2
- * 0: string1 == string2
- * > 0: string1 > string2
- */
-
-int
-utf8_charcasecmp (const char *string1, const char *string2)
-{
- wint_t wchar1, wchar2;
-
- /*
- * optimization for single-byte chars: only letters A-Z must be converted
- * to lowercase; this is faster than calling `towlower`
- */
- if (string1 && !((unsigned char)(string1[0]) & 0x80)
- && string2 && !((unsigned char)(string2[0]) & 0x80))
- {
- wchar1 = string1[0];
- if ((wchar1 >= 'A') && (wchar1 <= 'Z'))
- wchar1 += ('a' - 'A');
- wchar2 = string2[0];
- if ((wchar2 >= 'A') && (wchar2 <= 'Z'))
- wchar2 += ('a' - 'A');
- }
- else
- {
- wchar1 = towlower (utf8_char_int (string1));
- wchar2 = towlower (utf8_char_int (string2));
- }
-
- return wchar1 - wchar2;
-}
-
-/*
- * Compares two UTF-8 chars (case insensitive using a range).
- *
- * The range is the number of chars which can be converted from upper to lower
- * case. For example 26 = all letters of alphabet, 29 = all letters + 3 chars.
- *
- * Examples:
- * - range = 26: A-Z ==> a-z
- * - range = 29: A-Z [ \ ] ==> a-z { | }
- * - range = 30: A-Z [ \ ] ^ ==> a-z { | } ~
- * (ranges 29 and 30 are used by some protocols like IRC)
- *
- * Returns: arithmetic result of subtracting the last compared char in string2
- * (converted to lowercase) from the last compared char in string1 (converted
- * to lowercase):
- * < 0: string1 < string2
- * 0: string1 == string2
- * > 0: string1 > string2
- */
-
-int
-utf8_charcasecmp_range (const char *string1, const char *string2, int range)
-{
- wchar_t wchar1, wchar2;
-
- wchar1 = utf8_char_int (string1);
- if ((wchar1 >= (wchar_t)'A') && (wchar1 < (wchar_t)('A' + range)))
- wchar1 += ('a' - 'A');
-
- wchar2 = utf8_char_int (string2);
- if ((wchar2 >= (wchar_t)'A') && (wchar2 < (wchar_t)('A' + range)))
- wchar2 += ('a' - 'A');
-
- return wchar1 - wchar2;
-}
-
-/*
* Moves forward N chars in an UTF-8 string.
*
* Returns pointer to the new position in string.