Remove unused single-byte char_is_cased() API.
authorJeff Davis <jdavis@postgresql.org>
Mon, 15 Dec 2025 18:24:57 +0000 (10:24 -0800)
committerJeff Davis <jdavis@postgresql.org>
Mon, 15 Dec 2025 18:24:57 +0000 (10:24 -0800)
https://postgr.es/m/450ceb6260cad30d7afdf155d991a9caafee7c0d.camel@j-davis.com

src/backend/utils/adt/pg_locale.c
src/backend/utils/adt/pg_locale_builtin.c
src/backend/utils/adt/pg_locale_icu.c
src/backend/utils/adt/pg_locale_libc.c
src/include/utils/pg_locale.h

index 70933ee384360754e70373f488b716ca2e190539..8a3796aa5d0083e65c2dc6120df174d0264a5941 100644 (file)
@@ -1625,21 +1625,6 @@ pg_towlower(pg_wchar wc, pg_locale_t locale)
        return locale->ctype->wc_tolower(wc, locale);
 }
 
-/*
- * char_is_cased()
- *
- * Fuzzy test of whether the given char is case-varying or not. The argument
- * is a single byte, so in a multibyte encoding, just assume any non-ASCII
- * char is case-varying.
- */
-bool
-char_is_cased(char ch, pg_locale_t locale)
-{
-   if (locale->ctype == NULL)
-       return (ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z');
-   return locale->ctype->char_is_cased(ch, locale);
-}
-
 /*
  * Return required encoding ID for the given locale, or -1 if any encoding is
  * valid for the locale.
index 0d4c754a26732c93630ae001d364762598c05582..0c2920112bbb676bfa4d45e67e6cb74b532b73d0 100644 (file)
@@ -191,13 +191,6 @@ wc_iscased_builtin(pg_wchar wc, pg_locale_t locale)
    return pg_u_prop_cased(to_char32(wc));
 }
 
-static bool
-char_is_cased_builtin(char ch, pg_locale_t locale)
-{
-   return IS_HIGHBIT_SET(ch) ||
-       (ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z');
-}
-
 static pg_wchar
 wc_toupper_builtin(pg_wchar wc, pg_locale_t locale)
 {
@@ -225,7 +218,6 @@ static const struct ctype_methods ctype_methods_builtin = {
    .wc_ispunct = wc_ispunct_builtin,
    .wc_isspace = wc_isspace_builtin,
    .wc_isxdigit = wc_isxdigit_builtin,
-   .char_is_cased = char_is_cased_builtin,
    .wc_iscased = wc_iscased_builtin,
    .wc_tolower = wc_tolower_builtin,
    .wc_toupper = wc_toupper_builtin,
index e8820666b2d9f73d3cae226b3e03088c810d2910..18d026deda8e7d6db0296b9d14b9ed0b53be6b85 100644 (file)
@@ -121,13 +121,6 @@ static int32_t u_strFoldCase_default(UChar *dest, int32_t destCapacity,
                                     const char *locale,
                                     UErrorCode *pErrorCode);
 
-static bool
-char_is_cased_icu(char ch, pg_locale_t locale)
-{
-   return IS_HIGHBIT_SET(ch) ||
-       (ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z');
-}
-
 /*
  * XXX: many of the functions below rely on casts directly from pg_wchar to
  * UChar32, which is correct for the UTF-8 encoding, but not in general.
@@ -244,7 +237,6 @@ static const struct ctype_methods ctype_methods_icu = {
    .wc_ispunct = wc_ispunct_icu,
    .wc_isspace = wc_isspace_icu,
    .wc_isxdigit = wc_isxdigit_icu,
-   .char_is_cased = char_is_cased_icu,
    .wc_iscased = wc_iscased_icu,
    .wc_toupper = toupper_icu,
    .wc_tolower = tolower_icu,
index 3d841f818a51aff983ce278093bf206d9e560158..3baa5816b5fc842c20cd9bb973dfe7dcc21c999e 100644 (file)
@@ -262,17 +262,6 @@ wc_iscased_libc_mb(pg_wchar wc, pg_locale_t locale)
        iswlower_l((wint_t) wc, locale->lt);
 }
 
-static bool
-char_is_cased_libc(char ch, pg_locale_t locale)
-{
-   bool        is_multibyte = pg_database_encoding_max_length() > 1;
-
-   if (is_multibyte && IS_HIGHBIT_SET(ch))
-       return true;
-   else
-       return isalpha_l((unsigned char) ch, locale->lt);
-}
-
 static pg_wchar
 toupper_libc_sb(pg_wchar wc, pg_locale_t locale)
 {
@@ -345,7 +334,6 @@ static const struct ctype_methods ctype_methods_libc_sb = {
    .wc_ispunct = wc_ispunct_libc_sb,
    .wc_isspace = wc_isspace_libc_sb,
    .wc_isxdigit = wc_isxdigit_libc_sb,
-   .char_is_cased = char_is_cased_libc,
    .wc_iscased = wc_iscased_libc_sb,
    .wc_toupper = toupper_libc_sb,
    .wc_tolower = tolower_libc_sb,
@@ -371,7 +359,6 @@ static const struct ctype_methods ctype_methods_libc_other_mb = {
    .wc_ispunct = wc_ispunct_libc_sb,
    .wc_isspace = wc_isspace_libc_sb,
    .wc_isxdigit = wc_isxdigit_libc_sb,
-   .char_is_cased = char_is_cased_libc,
    .wc_iscased = wc_iscased_libc_sb,
    .wc_toupper = toupper_libc_sb,
    .wc_tolower = tolower_libc_sb,
@@ -393,7 +380,6 @@ static const struct ctype_methods ctype_methods_libc_utf8 = {
    .wc_ispunct = wc_ispunct_libc_mb,
    .wc_isspace = wc_isspace_libc_mb,
    .wc_isxdigit = wc_isxdigit_libc_mb,
-   .char_is_cased = char_is_cased_libc,
    .wc_iscased = wc_iscased_libc_mb,
    .wc_toupper = toupper_libc_mb,
    .wc_tolower = tolower_libc_mb,
index 832007385d87b080dd60ef70cea9ec19538b8681..a533463d5b744e4b6223a37049eeb10f0b15d857 100644 (file)
@@ -125,9 +125,6 @@ struct ctype_methods
    bool        (*wc_iscased) (pg_wchar wc, pg_locale_t locale);
    pg_wchar    (*wc_toupper) (pg_wchar wc, pg_locale_t locale);
    pg_wchar    (*wc_tolower) (pg_wchar wc, pg_locale_t locale);
-
-   /* required */
-   bool        (*char_is_cased) (char ch, pg_locale_t locale);
 };
 
 /*
@@ -178,7 +175,6 @@ extern pg_locale_t pg_newlocale_from_collation(Oid collid);
 
 extern char *get_collation_actual_version(char collprovider, const char *collcollate);
 
-extern bool char_is_cased(char ch, pg_locale_t locale);
 extern size_t pg_strlower(char *dst, size_t dstsize,
                          const char *src, ssize_t srclen,
                          pg_locale_t locale);