39#define STRDUP(s) pstrdup(s)
40#define ALLOC(size) palloc(size)
41#define FREE(size) pfree(size)
43#define STRDUP(s) strdup(s)
44#define ALLOC(size) malloc(size)
45#define FREE(size) free(size)
50static bool is_code_in_table(
char32_t code,
const char32_t *map,
int mapsize);
966#define IS_CODE_IN_TABLE(code, map) is_code_in_table(code, map, lengthof(map))
971 const char32_t *
key = (
const char32_t *)
a;
972 const char32_t *
range = (
const char32_t *)
b;
987 if (code < map[0] || code > map[mapsize - 1])
990 if (bsearch(&code, map, mapsize / 2,
sizeof(
char32_t) * 2,
1005 const unsigned char *p = (
const unsigned char *)
source;
1049 char32_t *input_chars = NULL;
1050 char32_t *output_chars = NULL;
1056 bool contains_RandALCat;
1086 input_chars =
ALLOC((input_size + 1) *
sizeof(
char32_t));
1090 p = (
unsigned char *)
input;
1091 for (
i = 0;
i < input_size;
i++)
1108 for (
i = 0;
i < input_size;
i++)
1110 char32_t code = input_chars[
i];
1113 input_chars[count++] = 0x0020;
1119 input_chars[count++] = code;
1121 input_chars[count] = (
char32_t)
'\0';
1124 if (input_size == 0)
1139 for (
i = 0;
i < input_size;
i++)
1141 char32_t code = input_chars[
i];
1170 contains_RandALCat =
false;
1171 for (
i = 0;
i < input_size;
i++)
1173 char32_t code = input_chars[
i];
1177 contains_RandALCat =
true;
1182 if (contains_RandALCat)
1184 char32_t first = input_chars[0];
1185 char32_t last = input_chars[input_size - 1];
1187 for (
i = 0;
i < input_size;
i++)
1189 char32_t code = input_chars[
i];
1204 for (wp = output_chars; *wp; wp++)
1206 unsigned char buf[4];
1212 result =
ALLOC(result_size + 1);
1220 p = (
unsigned char *) result;
1221 for (wp = output_chars; *wp; wp++)
1226 Assert((
char *) p == result + result_size);
Assert(PointerIsAligned(start, uint64))
static char32_t utf8_to_unicode(const unsigned char *c)
static rewind_source * source
static unsigned char * unicode_to_utf8(char32_t c, unsigned char *utf8string)
static struct cvec * range(struct vars *v, chr a, chr b, int cases)
static bool is_code_in_table(char32_t code, const char32_t *map, int mapsize)
static const char32_t LCat_codepoint_ranges[]
static int codepoint_range_cmp(const void *a, const void *b)
static const char32_t prohibited_output_ranges[]
static const char32_t commonly_mapped_to_nothing_ranges[]
#define IS_CODE_IN_TABLE(code, map)
pg_saslprep_rc pg_saslprep(const char *input, char **output)
static const char32_t unassigned_codepoint_ranges[]
static const char32_t RandALCat_codepoint_ranges[]
static int pg_utf8_string_len(const char *source)
static const char32_t non_ascii_space_ranges[]
bool pg_is_ascii(const char *str)
char32_t * unicode_normalize(UnicodeNormalizationForm form, const char32_t *input)
bool pg_utf8_islegal(const unsigned char *source, int length)