Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 235a569

Browse files
committed
Fix multi-byte+locale problem
1 parent 6febecc commit 235a569

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

src/backend/regex/regcomp.c

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,11 @@ extern "C"
9595
static void p_b_eclass(struct parse * p, cset *cs);
9696
static pg_wchar p_b_symbol(struct parse * p);
9797
static char p_b_coll_elem(struct parse * p, int endc);
98+
#ifdef MULTIBYTE
99+
static unsigned char othercase(int ch);
100+
#else
98101
static char othercase(int ch);
102+
#endif
99103
static void bothcases(struct parse * p, int ch);
100104
static void ordinary(struct parse * p, int ch);
101105
static void nonnewline(struct parse * p);
@@ -1032,18 +1036,34 @@ int endc; /* name ended by endc,']' */
10321036
- othercase - return the case counterpart of an alphabetic
10331037
== static char othercase(int ch);
10341038
*/
1035-
static char /* if no counterpart, return ch */
1039+
#ifdef MULTIBYTE
1040+
static unsigned char /* if no counterpart, return ch */
1041+
#else
1042+
static char /* if no counterpart, return ch */
1043+
#endif
10361044
othercase(ch)
10371045
int ch;
10381046
{
10391047
assert(pg_isalpha(ch));
10401048
if (pg_isupper(ch))
1049+
#ifdef MULTIBYTE
1050+
return (unsigned char)tolower(ch);
1051+
#else
10411052
return tolower(ch);
1053+
#endif
10421054
else if (pg_islower(ch))
1055+
#ifdef MULTIBYTE
1056+
return (unsigned char)toupper(ch);
1057+
#else
10431058
return toupper(ch);
1059+
#endif
10441060
else
10451061
/* peculiar, but could happen */
1062+
#ifdef MULTIBYTE
1063+
return (unsigned char)ch;
1064+
#else
10461065
return ch;
1066+
#endif
10471067
}
10481068

10491069
/*

0 commit comments

Comments
 (0)