mirror of https://github.com/postgres/postgres
Assume wcstombs(), towlower(), and sibling functions are always present.
These functions are required by SUS v2, which is our minimum baseline
for Unix platforms, and are present on all interesting Windows versions
as well. Even our oldest buildfarm members have them. Thus, we were not
testing the "!USE_WIDE_UPPER_LOWER" code paths, which explains why the bug
fixed in commit e6023ee7f
escaped detection. Per discussion, there seems
to be no more real-world value in maintaining this option. Hence, remove
the configure-time tests for wcstombs() and towlower(), remove the
USE_WIDE_UPPER_LOWER symbol, and remove all the !USE_WIDE_UPPER_LOWER code.
There's not actually all that much of the latter, but simplifying the #if
nests is a win in itself.
Discussion: https://postgr.es/m/20170921052928.GA188913@rfd.leadboat.com
This commit is contained in:
parent
e6023ee7fa
commit
85feb77aa0
|
@ -12970,7 +12970,7 @@ fi
|
|||
LIBS_including_readline="$LIBS"
|
||||
LIBS=`echo "$LIBS" | sed -e 's/-ledit//g' -e 's/-lreadline//g'`
|
||||
|
||||
for ac_func in cbrt clock_gettime dlopen fdatasync getifaddrs getpeerucred getrlimit mbstowcs_l memmove poll pstat pthread_is_threaded_np readlink setproctitle setsid shm_open symlink sync_file_range towlower utime utimes wcstombs wcstombs_l
|
||||
for ac_func in cbrt clock_gettime dlopen fdatasync getifaddrs getpeerucred getrlimit mbstowcs_l memmove poll pstat pthread_is_threaded_np readlink setproctitle setsid shm_open symlink sync_file_range utime utimes wcstombs_l
|
||||
do :
|
||||
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
|
||||
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
|
||||
|
|
|
@ -1399,7 +1399,7 @@ PGAC_FUNC_WCSTOMBS_L
|
|||
LIBS_including_readline="$LIBS"
|
||||
LIBS=`echo "$LIBS" | sed -e 's/-ledit//g' -e 's/-lreadline//g'`
|
||||
|
||||
AC_CHECK_FUNCS([cbrt clock_gettime dlopen fdatasync getifaddrs getpeerucred getrlimit mbstowcs_l memmove poll pstat pthread_is_threaded_np readlink setproctitle setsid shm_open symlink sync_file_range towlower utime utimes wcstombs wcstombs_l])
|
||||
AC_CHECK_FUNCS([cbrt clock_gettime dlopen fdatasync getifaddrs getpeerucred getrlimit mbstowcs_l memmove poll pstat pthread_is_threaded_np readlink setproctitle setsid shm_open symlink sync_file_range utime utimes wcstombs_l])
|
||||
|
||||
AC_REPLACE_FUNCS(fseeko)
|
||||
case $host_os in
|
||||
|
|
|
@ -268,7 +268,6 @@ pg_set_regex_collation(Oid collation)
|
|||
pg_regex_strategy = PG_REGEX_LOCALE_ICU;
|
||||
else
|
||||
#endif
|
||||
#ifdef USE_WIDE_UPPER_LOWER
|
||||
if (GetDatabaseEncoding() == PG_UTF8)
|
||||
{
|
||||
if (pg_regex_locale)
|
||||
|
@ -277,7 +276,6 @@ pg_set_regex_collation(Oid collation)
|
|||
pg_regex_strategy = PG_REGEX_LOCALE_WIDE;
|
||||
}
|
||||
else
|
||||
#endif /* USE_WIDE_UPPER_LOWER */
|
||||
{
|
||||
if (pg_regex_locale)
|
||||
pg_regex_strategy = PG_REGEX_LOCALE_1BYTE_L;
|
||||
|
@ -298,16 +296,14 @@ pg_wc_isdigit(pg_wchar c)
|
|||
return (c <= (pg_wchar) 127 &&
|
||||
(pg_char_properties[c] & PG_ISDIGIT));
|
||||
case PG_REGEX_LOCALE_WIDE:
|
||||
#ifdef USE_WIDE_UPPER_LOWER
|
||||
if (sizeof(wchar_t) >= 4 || c <= (pg_wchar) 0xFFFF)
|
||||
return iswdigit((wint_t) c);
|
||||
#endif
|
||||
/* FALL THRU */
|
||||
case PG_REGEX_LOCALE_1BYTE:
|
||||
return (c <= (pg_wchar) UCHAR_MAX &&
|
||||
isdigit((unsigned char) c));
|
||||
case PG_REGEX_LOCALE_WIDE_L:
|
||||
#if defined(HAVE_LOCALE_T) && defined(USE_WIDE_UPPER_LOWER)
|
||||
#ifdef HAVE_LOCALE_T
|
||||
if (sizeof(wchar_t) >= 4 || c <= (pg_wchar) 0xFFFF)
|
||||
return iswdigit_l((wint_t) c, pg_regex_locale->info.lt);
|
||||
#endif
|
||||
|
@ -336,16 +332,14 @@ pg_wc_isalpha(pg_wchar c)
|
|||
return (c <= (pg_wchar) 127 &&
|
||||
(pg_char_properties[c] & PG_ISALPHA));
|
||||
case PG_REGEX_LOCALE_WIDE:
|
||||
#ifdef USE_WIDE_UPPER_LOWER
|
||||
if (sizeof(wchar_t) >= 4 || c <= (pg_wchar) 0xFFFF)
|
||||
return iswalpha((wint_t) c);
|
||||
#endif
|
||||
/* FALL THRU */
|
||||
case PG_REGEX_LOCALE_1BYTE:
|
||||
return (c <= (pg_wchar) UCHAR_MAX &&
|
||||
isalpha((unsigned char) c));
|
||||
case PG_REGEX_LOCALE_WIDE_L:
|
||||
#if defined(HAVE_LOCALE_T) && defined(USE_WIDE_UPPER_LOWER)
|
||||
#ifdef HAVE_LOCALE_T
|
||||
if (sizeof(wchar_t) >= 4 || c <= (pg_wchar) 0xFFFF)
|
||||
return iswalpha_l((wint_t) c, pg_regex_locale->info.lt);
|
||||
#endif
|
||||
|
@ -374,16 +368,14 @@ pg_wc_isalnum(pg_wchar c)
|
|||
return (c <= (pg_wchar) 127 &&
|
||||
(pg_char_properties[c] & PG_ISALNUM));
|
||||
case PG_REGEX_LOCALE_WIDE:
|
||||
#ifdef USE_WIDE_UPPER_LOWER
|
||||
if (sizeof(wchar_t) >= 4 || c <= (pg_wchar) 0xFFFF)
|
||||
return iswalnum((wint_t) c);
|
||||
#endif
|
||||
/* FALL THRU */
|
||||
case PG_REGEX_LOCALE_1BYTE:
|
||||
return (c <= (pg_wchar) UCHAR_MAX &&
|
||||
isalnum((unsigned char) c));
|
||||
case PG_REGEX_LOCALE_WIDE_L:
|
||||
#if defined(HAVE_LOCALE_T) && defined(USE_WIDE_UPPER_LOWER)
|
||||
#ifdef HAVE_LOCALE_T
|
||||
if (sizeof(wchar_t) >= 4 || c <= (pg_wchar) 0xFFFF)
|
||||
return iswalnum_l((wint_t) c, pg_regex_locale->info.lt);
|
||||
#endif
|
||||
|
@ -412,16 +404,14 @@ pg_wc_isupper(pg_wchar c)
|
|||
return (c <= (pg_wchar) 127 &&
|
||||
(pg_char_properties[c] & PG_ISUPPER));
|
||||
case PG_REGEX_LOCALE_WIDE:
|
||||
#ifdef USE_WIDE_UPPER_LOWER
|
||||
if (sizeof(wchar_t) >= 4 || c <= (pg_wchar) 0xFFFF)
|
||||
return iswupper((wint_t) c);
|
||||
#endif
|
||||
/* FALL THRU */
|
||||
case PG_REGEX_LOCALE_1BYTE:
|
||||
return (c <= (pg_wchar) UCHAR_MAX &&
|
||||
isupper((unsigned char) c));
|
||||
case PG_REGEX_LOCALE_WIDE_L:
|
||||
#if defined(HAVE_LOCALE_T) && defined(USE_WIDE_UPPER_LOWER)
|
||||
#ifdef HAVE_LOCALE_T
|
||||
if (sizeof(wchar_t) >= 4 || c <= (pg_wchar) 0xFFFF)
|
||||
return iswupper_l((wint_t) c, pg_regex_locale->info.lt);
|
||||
#endif
|
||||
|
@ -450,16 +440,14 @@ pg_wc_islower(pg_wchar c)
|
|||
return (c <= (pg_wchar) 127 &&
|
||||
(pg_char_properties[c] & PG_ISLOWER));
|
||||
case PG_REGEX_LOCALE_WIDE:
|
||||
#ifdef USE_WIDE_UPPER_LOWER
|
||||
if (sizeof(wchar_t) >= 4 || c <= (pg_wchar) 0xFFFF)
|
||||
return iswlower((wint_t) c);
|
||||
#endif
|
||||
/* FALL THRU */
|
||||
case PG_REGEX_LOCALE_1BYTE:
|
||||
return (c <= (pg_wchar) UCHAR_MAX &&
|
||||
islower((unsigned char) c));
|
||||
case PG_REGEX_LOCALE_WIDE_L:
|
||||
#if defined(HAVE_LOCALE_T) && defined(USE_WIDE_UPPER_LOWER)
|
||||
#ifdef HAVE_LOCALE_T
|
||||
if (sizeof(wchar_t) >= 4 || c <= (pg_wchar) 0xFFFF)
|
||||
return iswlower_l((wint_t) c, pg_regex_locale->info.lt);
|
||||
#endif
|
||||
|
@ -488,16 +476,14 @@ pg_wc_isgraph(pg_wchar c)
|
|||
return (c <= (pg_wchar) 127 &&
|
||||
(pg_char_properties[c] & PG_ISGRAPH));
|
||||
case PG_REGEX_LOCALE_WIDE:
|
||||
#ifdef USE_WIDE_UPPER_LOWER
|
||||
if (sizeof(wchar_t) >= 4 || c <= (pg_wchar) 0xFFFF)
|
||||
return iswgraph((wint_t) c);
|
||||
#endif
|
||||
/* FALL THRU */
|
||||
case PG_REGEX_LOCALE_1BYTE:
|
||||
return (c <= (pg_wchar) UCHAR_MAX &&
|
||||
isgraph((unsigned char) c));
|
||||
case PG_REGEX_LOCALE_WIDE_L:
|
||||
#if defined(HAVE_LOCALE_T) && defined(USE_WIDE_UPPER_LOWER)
|
||||
#ifdef HAVE_LOCALE_T
|
||||
if (sizeof(wchar_t) >= 4 || c <= (pg_wchar) 0xFFFF)
|
||||
return iswgraph_l((wint_t) c, pg_regex_locale->info.lt);
|
||||
#endif
|
||||
|
@ -526,16 +512,14 @@ pg_wc_isprint(pg_wchar c)
|
|||
return (c <= (pg_wchar) 127 &&
|
||||
(pg_char_properties[c] & PG_ISPRINT));
|
||||
case PG_REGEX_LOCALE_WIDE:
|
||||
#ifdef USE_WIDE_UPPER_LOWER
|
||||
if (sizeof(wchar_t) >= 4 || c <= (pg_wchar) 0xFFFF)
|
||||
return iswprint((wint_t) c);
|
||||
#endif
|
||||
/* FALL THRU */
|
||||
case PG_REGEX_LOCALE_1BYTE:
|
||||
return (c <= (pg_wchar) UCHAR_MAX &&
|
||||
isprint((unsigned char) c));
|
||||
case PG_REGEX_LOCALE_WIDE_L:
|
||||
#if defined(HAVE_LOCALE_T) && defined(USE_WIDE_UPPER_LOWER)
|
||||
#ifdef HAVE_LOCALE_T
|
||||
if (sizeof(wchar_t) >= 4 || c <= (pg_wchar) 0xFFFF)
|
||||
return iswprint_l((wint_t) c, pg_regex_locale->info.lt);
|
||||
#endif
|
||||
|
@ -564,16 +548,14 @@ pg_wc_ispunct(pg_wchar c)
|
|||
return (c <= (pg_wchar) 127 &&
|
||||
(pg_char_properties[c] & PG_ISPUNCT));
|
||||
case PG_REGEX_LOCALE_WIDE:
|
||||
#ifdef USE_WIDE_UPPER_LOWER
|
||||
if (sizeof(wchar_t) >= 4 || c <= (pg_wchar) 0xFFFF)
|
||||
return iswpunct((wint_t) c);
|
||||
#endif
|
||||
/* FALL THRU */
|
||||
case PG_REGEX_LOCALE_1BYTE:
|
||||
return (c <= (pg_wchar) UCHAR_MAX &&
|
||||
ispunct((unsigned char) c));
|
||||
case PG_REGEX_LOCALE_WIDE_L:
|
||||
#if defined(HAVE_LOCALE_T) && defined(USE_WIDE_UPPER_LOWER)
|
||||
#ifdef HAVE_LOCALE_T
|
||||
if (sizeof(wchar_t) >= 4 || c <= (pg_wchar) 0xFFFF)
|
||||
return iswpunct_l((wint_t) c, pg_regex_locale->info.lt);
|
||||
#endif
|
||||
|
@ -602,16 +584,14 @@ pg_wc_isspace(pg_wchar c)
|
|||
return (c <= (pg_wchar) 127 &&
|
||||
(pg_char_properties[c] & PG_ISSPACE));
|
||||
case PG_REGEX_LOCALE_WIDE:
|
||||
#ifdef USE_WIDE_UPPER_LOWER
|
||||
if (sizeof(wchar_t) >= 4 || c <= (pg_wchar) 0xFFFF)
|
||||
return iswspace((wint_t) c);
|
||||
#endif
|
||||
/* FALL THRU */
|
||||
case PG_REGEX_LOCALE_1BYTE:
|
||||
return (c <= (pg_wchar) UCHAR_MAX &&
|
||||
isspace((unsigned char) c));
|
||||
case PG_REGEX_LOCALE_WIDE_L:
|
||||
#if defined(HAVE_LOCALE_T) && defined(USE_WIDE_UPPER_LOWER)
|
||||
#ifdef HAVE_LOCALE_T
|
||||
if (sizeof(wchar_t) >= 4 || c <= (pg_wchar) 0xFFFF)
|
||||
return iswspace_l((wint_t) c, pg_regex_locale->info.lt);
|
||||
#endif
|
||||
|
@ -644,10 +624,8 @@ pg_wc_toupper(pg_wchar c)
|
|||
/* force C behavior for ASCII characters, per comments above */
|
||||
if (c <= (pg_wchar) 127)
|
||||
return pg_ascii_toupper((unsigned char) c);
|
||||
#ifdef USE_WIDE_UPPER_LOWER
|
||||
if (sizeof(wchar_t) >= 4 || c <= (pg_wchar) 0xFFFF)
|
||||
return towupper((wint_t) c);
|
||||
#endif
|
||||
/* FALL THRU */
|
||||
case PG_REGEX_LOCALE_1BYTE:
|
||||
/* force C behavior for ASCII characters, per comments above */
|
||||
|
@ -657,7 +635,7 @@ pg_wc_toupper(pg_wchar c)
|
|||
return toupper((unsigned char) c);
|
||||
return c;
|
||||
case PG_REGEX_LOCALE_WIDE_L:
|
||||
#if defined(HAVE_LOCALE_T) && defined(USE_WIDE_UPPER_LOWER)
|
||||
#ifdef HAVE_LOCALE_T
|
||||
if (sizeof(wchar_t) >= 4 || c <= (pg_wchar) 0xFFFF)
|
||||
return towupper_l((wint_t) c, pg_regex_locale->info.lt);
|
||||
#endif
|
||||
|
@ -690,10 +668,8 @@ pg_wc_tolower(pg_wchar c)
|
|||
/* force C behavior for ASCII characters, per comments above */
|
||||
if (c <= (pg_wchar) 127)
|
||||
return pg_ascii_tolower((unsigned char) c);
|
||||
#ifdef USE_WIDE_UPPER_LOWER
|
||||
if (sizeof(wchar_t) >= 4 || c <= (pg_wchar) 0xFFFF)
|
||||
return towlower((wint_t) c);
|
||||
#endif
|
||||
/* FALL THRU */
|
||||
case PG_REGEX_LOCALE_1BYTE:
|
||||
/* force C behavior for ASCII characters, per comments above */
|
||||
|
@ -703,7 +679,7 @@ pg_wc_tolower(pg_wchar c)
|
|||
return tolower((unsigned char) c);
|
||||
return c;
|
||||
case PG_REGEX_LOCALE_WIDE_L:
|
||||
#if defined(HAVE_LOCALE_T) && defined(USE_WIDE_UPPER_LOWER)
|
||||
#ifdef HAVE_LOCALE_T
|
||||
if (sizeof(wchar_t) >= 4 || c <= (pg_wchar) 0xFFFF)
|
||||
return towlower_l((wint_t) c, pg_regex_locale->info.lt);
|
||||
#endif
|
||||
|
|
|
@ -178,7 +178,6 @@ RS_free(Regis *r)
|
|||
r->node = NULL;
|
||||
}
|
||||
|
||||
#ifdef USE_WIDE_UPPER_LOWER
|
||||
static bool
|
||||
mb_strchr(char *str, char *c)
|
||||
{
|
||||
|
@ -209,10 +208,6 @@ mb_strchr(char *str, char *c)
|
|||
|
||||
return res;
|
||||
}
|
||||
#else
|
||||
#define mb_strchr(s,c) ( (strchr((s),*(c)) == NULL) ? false : true )
|
||||
#endif
|
||||
|
||||
|
||||
bool
|
||||
RS_execute(Regis *r, char *str)
|
||||
|
|
|
@ -21,8 +21,6 @@
|
|||
static void tsearch_readline_callback(void *arg);
|
||||
|
||||
|
||||
#ifdef USE_WIDE_UPPER_LOWER
|
||||
|
||||
int
|
||||
t_isdigit(const char *ptr)
|
||||
{
|
||||
|
@ -86,7 +84,6 @@ t_isprint(const char *ptr)
|
|||
|
||||
return iswprint((wint_t) character[0]);
|
||||
}
|
||||
#endif /* USE_WIDE_UPPER_LOWER */
|
||||
|
||||
|
||||
/*
|
||||
|
@ -244,17 +241,12 @@ char *
|
|||
lowerstr_with_len(const char *str, int len)
|
||||
{
|
||||
char *out;
|
||||
|
||||
#ifdef USE_WIDE_UPPER_LOWER
|
||||
Oid collation = DEFAULT_COLLATION_OID; /* TODO */
|
||||
pg_locale_t mylocale = 0; /* TODO */
|
||||
#endif
|
||||
|
||||
if (len == 0)
|
||||
return pstrdup("");
|
||||
|
||||
#ifdef USE_WIDE_UPPER_LOWER
|
||||
|
||||
/*
|
||||
* Use wide char code only when max encoding length > 1 and ctype != C.
|
||||
* Some operating systems fail with multi-byte encodings and a C locale.
|
||||
|
@ -300,7 +292,6 @@ lowerstr_with_len(const char *str, int len)
|
|||
Assert(wlen < len);
|
||||
}
|
||||
else
|
||||
#endif /* USE_WIDE_UPPER_LOWER */
|
||||
{
|
||||
const char *ptr = str;
|
||||
char *outptr;
|
||||
|
|
|
@ -241,11 +241,9 @@ typedef struct TParser
|
|||
/* string and position information */
|
||||
char *str; /* multibyte string */
|
||||
int lenstr; /* length of mbstring */
|
||||
#ifdef USE_WIDE_UPPER_LOWER
|
||||
wchar_t *wstr; /* wide character string */
|
||||
pg_wchar *pgwstr; /* wide character string for C-locale */
|
||||
bool usewide;
|
||||
#endif
|
||||
|
||||
/* State of parse */
|
||||
int charmaxlen;
|
||||
|
@ -294,8 +292,6 @@ TParserInit(char *str, int len)
|
|||
prs->str = str;
|
||||
prs->lenstr = len;
|
||||
|
||||
#ifdef USE_WIDE_UPPER_LOWER
|
||||
|
||||
/*
|
||||
* Use wide char code only when max encoding length > 1.
|
||||
*/
|
||||
|
@ -323,7 +319,6 @@ TParserInit(char *str, int len)
|
|||
}
|
||||
else
|
||||
prs->usewide = false;
|
||||
#endif
|
||||
|
||||
prs->state = newTParserPosition(NULL);
|
||||
prs->state->state = TPS_Base;
|
||||
|
@ -360,15 +355,12 @@ TParserCopyInit(const TParser *orig)
|
|||
prs->charmaxlen = orig->charmaxlen;
|
||||
prs->str = orig->str + orig->state->posbyte;
|
||||
prs->lenstr = orig->lenstr - orig->state->posbyte;
|
||||
|
||||
#ifdef USE_WIDE_UPPER_LOWER
|
||||
prs->usewide = orig->usewide;
|
||||
|
||||
if (orig->pgwstr)
|
||||
prs->pgwstr = orig->pgwstr + orig->state->poschar;
|
||||
if (orig->wstr)
|
||||
prs->wstr = orig->wstr + orig->state->poschar;
|
||||
#endif
|
||||
|
||||
prs->state = newTParserPosition(NULL);
|
||||
prs->state->state = TPS_Base;
|
||||
|
@ -393,12 +385,10 @@ TParserClose(TParser *prs)
|
|||
prs->state = ptr;
|
||||
}
|
||||
|
||||
#ifdef USE_WIDE_UPPER_LOWER
|
||||
if (prs->wstr)
|
||||
pfree(prs->wstr);
|
||||
if (prs->pgwstr)
|
||||
pfree(prs->pgwstr);
|
||||
#endif
|
||||
|
||||
#ifdef WPARSER_TRACE
|
||||
fprintf(stderr, "closing parser\n");
|
||||
|
@ -437,8 +427,6 @@ TParserCopyClose(TParser *prs)
|
|||
* - if locale is C then we use pgwstr instead of wstr.
|
||||
*/
|
||||
|
||||
#ifdef USE_WIDE_UPPER_LOWER
|
||||
|
||||
#define p_iswhat(type) \
|
||||
static int \
|
||||
p_is##type(TParser *prs) { \
|
||||
|
@ -536,31 +524,6 @@ p_iseq(TParser *prs, char c)
|
|||
Assert(prs->state);
|
||||
return ((prs->state->charlen == 1 && *(prs->str + prs->state->posbyte) == c)) ? 1 : 0;
|
||||
}
|
||||
#else /* USE_WIDE_UPPER_LOWER */
|
||||
|
||||
#define p_iswhat(type) \
|
||||
static int \
|
||||
p_is##type(TParser *prs) { \
|
||||
Assert( prs->state ); \
|
||||
return is##type( (unsigned char)*( prs->str + prs->state->posbyte ) ); \
|
||||
} \
|
||||
\
|
||||
static int \
|
||||
p_isnot##type(TParser *prs) { \
|
||||
return !p_is##type(prs); \
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
p_iseq(TParser *prs, char c)
|
||||
{
|
||||
Assert(prs->state);
|
||||
return (*(prs->str + prs->state->posbyte) == c) ? 1 : 0;
|
||||
}
|
||||
|
||||
p_iswhat(alnum)
|
||||
p_iswhat(alpha)
|
||||
#endif /* USE_WIDE_UPPER_LOWER */
|
||||
|
||||
p_iswhat(digit)
|
||||
p_iswhat(lower)
|
||||
|
@ -785,8 +748,6 @@ p_isspecial(TParser *prs)
|
|||
if (pg_dsplen(prs->str + prs->state->posbyte) == 0)
|
||||
return 1;
|
||||
|
||||
#ifdef USE_WIDE_UPPER_LOWER
|
||||
|
||||
/*
|
||||
* Unicode Characters in the 'Mark, Spacing Combining' Category That
|
||||
* characters are not alpha although they are not breakers of word too.
|
||||
|
@ -1050,7 +1011,6 @@ p_isspecial(TParser *prs)
|
|||
StopHigh = StopMiddle;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -1565,7 +1565,6 @@ str_tolower(const char *buff, size_t nbytes, Oid collid)
|
|||
else
|
||||
#endif
|
||||
{
|
||||
#ifdef USE_WIDE_UPPER_LOWER
|
||||
if (pg_database_encoding_max_length() > 1)
|
||||
{
|
||||
wchar_t *workspace;
|
||||
|
@ -1604,7 +1603,6 @@ str_tolower(const char *buff, size_t nbytes, Oid collid)
|
|||
pfree(workspace);
|
||||
}
|
||||
else
|
||||
#endif /* USE_WIDE_UPPER_LOWER */
|
||||
{
|
||||
char *p;
|
||||
|
||||
|
@ -1689,7 +1687,6 @@ str_toupper(const char *buff, size_t nbytes, Oid collid)
|
|||
else
|
||||
#endif
|
||||
{
|
||||
#ifdef USE_WIDE_UPPER_LOWER
|
||||
if (pg_database_encoding_max_length() > 1)
|
||||
{
|
||||
wchar_t *workspace;
|
||||
|
@ -1728,7 +1725,6 @@ str_toupper(const char *buff, size_t nbytes, Oid collid)
|
|||
pfree(workspace);
|
||||
}
|
||||
else
|
||||
#endif /* USE_WIDE_UPPER_LOWER */
|
||||
{
|
||||
char *p;
|
||||
|
||||
|
@ -1814,7 +1810,6 @@ str_initcap(const char *buff, size_t nbytes, Oid collid)
|
|||
else
|
||||
#endif
|
||||
{
|
||||
#ifdef USE_WIDE_UPPER_LOWER
|
||||
if (pg_database_encoding_max_length() > 1)
|
||||
{
|
||||
wchar_t *workspace;
|
||||
|
@ -1865,7 +1860,6 @@ str_initcap(const char *buff, size_t nbytes, Oid collid)
|
|||
pfree(workspace);
|
||||
}
|
||||
else
|
||||
#endif /* USE_WIDE_UPPER_LOWER */
|
||||
{
|
||||
char *p;
|
||||
|
||||
|
|
|
@ -1587,6 +1587,7 @@ icu_from_uchar(char **result, const UChar *buff_uchar, int32_t len_uchar)
|
|||
|
||||
return len_result;
|
||||
}
|
||||
|
||||
#endif /* USE_ICU */
|
||||
|
||||
/*
|
||||
|
@ -1594,8 +1595,6 @@ icu_from_uchar(char **result, const UChar *buff_uchar, int32_t len_uchar)
|
|||
* Therefore we keep them here rather than with the mbutils code.
|
||||
*/
|
||||
|
||||
#ifdef USE_WIDE_UPPER_LOWER
|
||||
|
||||
/*
|
||||
* wchar2char --- convert wide characters to multibyte format
|
||||
*
|
||||
|
@ -1762,5 +1761,3 @@ char2wchar(wchar_t *to, size_t tolen, const char *from, size_t fromlen,
|
|||
|
||||
return result;
|
||||
}
|
||||
|
||||
#endif /* USE_WIDE_UPPER_LOWER */
|
||||
|
|
|
@ -1095,14 +1095,6 @@ extern int fdatasync(int fildes);
|
|||
#define HAVE_STRTOULL 1
|
||||
#endif
|
||||
|
||||
/*
|
||||
* We assume if we have these two functions, we have their friends too, and
|
||||
* can use the wide-character functions.
|
||||
*/
|
||||
#if defined(HAVE_WCSTOMBS) && defined(HAVE_TOWLOWER)
|
||||
#define USE_WIDE_UPPER_LOWER
|
||||
#endif
|
||||
|
||||
/* EXEC_BACKEND defines */
|
||||
#ifdef EXEC_BACKEND
|
||||
#define NON_EXEC_STATIC
|
||||
|
|
|
@ -593,9 +593,6 @@
|
|||
`HAVE_STRUCT_TM_TM_ZONE' instead. */
|
||||
#undef HAVE_TM_ZONE
|
||||
|
||||
/* Define to 1 if you have the `towlower' function. */
|
||||
#undef HAVE_TOWLOWER
|
||||
|
||||
/* Define to 1 if your compiler understands `typeof' or something similar. */
|
||||
#undef HAVE_TYPEOF
|
||||
|
||||
|
@ -659,9 +656,6 @@
|
|||
/* Define to 1 if you have the <wchar.h> header file. */
|
||||
#undef HAVE_WCHAR_H
|
||||
|
||||
/* Define to 1 if you have the `wcstombs' function. */
|
||||
#undef HAVE_WCSTOMBS
|
||||
|
||||
/* Define to 1 if you have the `wcstombs_l' function. */
|
||||
#undef HAVE_WCSTOMBS_L
|
||||
|
||||
|
|
|
@ -442,9 +442,6 @@
|
|||
`HAVE_STRUCT_TM_TM_ZONE' instead. */
|
||||
/* #undef HAVE_TM_ZONE */
|
||||
|
||||
/* Define to 1 if you have the `towlower' function. */
|
||||
#define HAVE_TOWLOWER 1
|
||||
|
||||
/* Define to 1 if your compiler understands `typeof' or something similar. */
|
||||
/* #undef HAVE_TYPEOF */
|
||||
|
||||
|
@ -484,9 +481,6 @@
|
|||
/* Define to 1 if you have the <wchar.h> header file. */
|
||||
#define HAVE_WCHAR_H 1
|
||||
|
||||
/* Define to 1 if you have the `wcstombs' function. */
|
||||
#define HAVE_WCSTOMBS 1
|
||||
|
||||
/* Define to 1 if you have the `wcstombs_l' function. */
|
||||
#define HAVE_WCSTOMBS_L 1
|
||||
|
||||
|
|
|
@ -41,28 +41,16 @@ typedef struct
|
|||
|
||||
#define TOUCHAR(x) (*((const unsigned char *) (x)))
|
||||
|
||||
#ifdef USE_WIDE_UPPER_LOWER
|
||||
/* The second argument of t_iseq() must be a plain ASCII character */
|
||||
#define t_iseq(x,c) (TOUCHAR(x) == (unsigned char) (c))
|
||||
|
||||
#define COPYCHAR(d,s) memcpy(d, s, pg_mblen(s))
|
||||
|
||||
extern int t_isdigit(const char *ptr);
|
||||
extern int t_isspace(const char *ptr);
|
||||
extern int t_isalpha(const char *ptr);
|
||||
extern int t_isprint(const char *ptr);
|
||||
|
||||
/* The second argument of t_iseq() must be a plain ASCII character */
|
||||
#define t_iseq(x,c) (TOUCHAR(x) == (unsigned char) (c))
|
||||
|
||||
#define COPYCHAR(d,s) memcpy(d, s, pg_mblen(s))
|
||||
#else /* not USE_WIDE_UPPER_LOWER */
|
||||
|
||||
#define t_isdigit(x) isdigit(TOUCHAR(x))
|
||||
#define t_isspace(x) isspace(TOUCHAR(x))
|
||||
#define t_isalpha(x) isalpha(TOUCHAR(x))
|
||||
#define t_isprint(x) isprint(TOUCHAR(x))
|
||||
#define t_iseq(x,c) (TOUCHAR(x) == (unsigned char) (c))
|
||||
|
||||
#define COPYCHAR(d,s) (*((unsigned char *) (d)) = TOUCHAR(s))
|
||||
#endif /* USE_WIDE_UPPER_LOWER */
|
||||
|
||||
extern char *lowerstr(const char *str);
|
||||
extern char *lowerstr_with_len(const char *str, int len);
|
||||
|
||||
|
|
|
@ -110,11 +110,9 @@ extern int32_t icu_from_uchar(char **result, const UChar *buff_uchar, int32_t le
|
|||
#endif
|
||||
|
||||
/* These functions convert from/to libc's wchar_t, *not* pg_wchar_t */
|
||||
#ifdef USE_WIDE_UPPER_LOWER
|
||||
extern size_t wchar2char(char *to, const wchar_t *from, size_t tolen,
|
||||
pg_locale_t locale);
|
||||
extern size_t char2wchar(wchar_t *to, size_t tolen,
|
||||
const char *from, size_t fromlen, pg_locale_t locale);
|
||||
#endif
|
||||
|
||||
#endif /* _PG_LOCALE_ */
|
||||
|
|
Loading…
Reference in New Issue