Skip to content

Commit 8d29905

Browse files
committed
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>
1 parent ec4997a commit 8d29905

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/include/utils/pg_locale.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,20 @@
2626
/* use for libc locale names */
2727
#define LOCALE_NAME_BUFLEN 128
2828

29+
/*
30+
* Maximum number of bytes needed to map a single codepoint. Useful for
31+
* mapping and processing a single input codepoint at a time with a
32+
* statically-allocated buffer.
33+
*
34+
* With full case mapping, an input codepoint may be mapped to as many as
35+
* three output codepoints. See Unicode 16.0.0, section 5.18.2, "Change in
36+
* Length":
37+
*
38+
* https://www.unicode.org/versions/Unicode16.0.0/core-spec/chapter-5/#G29675
39+
*/
40+
#define UNICODE_CASEMAP_LEN 3
41+
#define UNICODE_CASEMAP_BUFSZ (UNICODE_CASEMAP_LEN * sizeof(char32_t))
42+
2943
/* GUC settings */
3044
extern PGDLLIMPORT char *locale_messages;
3145
extern PGDLLIMPORT char *locale_monetary;

0 commit comments

Comments
 (0)