diff options
| author | Jeff Davis <jdavis@postgresql.org> | 2025-11-26 10:05:11 -0800 |
|---|---|---|
| committer | Jeff Davis <jdavis@postgresql.org> | 2025-11-26 10:05:11 -0800 |
| commit | 8d299052fe5858319fbd9be5f234026711bbc91b (patch) | |
| tree | 7d00e2600d2bc41373fbdff55e2322a51c444905 /src | |
| parent | ec4997a9d733e91b614d0c2f3e6445cc2905fd16 (diff) | |
Add #define for UNICODE_CASEMAP_BUFSZ.
Useful for mapping a single codepoint at a time into a
statically-allocated buffer.
Discussion: https://postgr.es/m/450ceb6260cad30d7afdf155d991a9caafee7c0d.camel@j-davis.com
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Diffstat (limited to 'src')
| -rw-r--r-- | src/include/utils/pg_locale.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/include/utils/pg_locale.h b/src/include/utils/pg_locale.h index 683e1a0eef8..54193a17a90 100644 --- a/src/include/utils/pg_locale.h +++ b/src/include/utils/pg_locale.h @@ -26,6 +26,20 @@ /* use for libc locale names */ #define LOCALE_NAME_BUFLEN 128 +/* + * Maximum number of bytes needed to map a single codepoint. Useful for + * mapping and processing a single input codepoint at a time with a + * statically-allocated buffer. + * + * With full case mapping, an input codepoint may be mapped to as many as + * three output codepoints. See Unicode 16.0.0, section 5.18.2, "Change in + * Length": + * + * https://www.unicode.org/versions/Unicode16.0.0/core-spec/chapter-5/#G29675 + */ +#define UNICODE_CASEMAP_LEN 3 +#define UNICODE_CASEMAP_BUFSZ (UNICODE_CASEMAP_LEN * sizeof(char32_t)) + /* GUC settings */ extern PGDLLIMPORT char *locale_messages; extern PGDLLIMPORT char *locale_monetary; |
