1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-27 12:41:57 +03:00

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:
Tom Lane
2017-09-22 11:00:58 -04:00
parent e6023ee7fa
commit 85feb77aa0
13 changed files with 18 additions and 139 deletions

View File

@ -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);