Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitec4997a

Browse files
committed
Inline pg_ascii_tolower() and pg_ascii_toupper().
Discussion:https://postgr.es/m/450ceb6260cad30d7afdf155d991a9caafee7c0d.camel@j-davis.comReviewed-by: Chao Li <li.evan.chao@gmail.com>
1 parent2dd506b commitec4997a

File tree

2 files changed

+23
-28
lines changed

2 files changed

+23
-28
lines changed

‎src/include/port.h‎

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,29 @@ extern intpg_strcasecmp(const char *s1, const char *s2);
169169
externintpg_strncasecmp(constchar*s1,constchar*s2,size_tn);
170170
externunsignedcharpg_toupper(unsignedcharch);
171171
externunsignedcharpg_tolower(unsignedcharch);
172-
externunsignedcharpg_ascii_toupper(unsignedcharch);
173-
externunsignedcharpg_ascii_tolower(unsignedcharch);
172+
173+
/*
174+
* Fold a character to upper case, following C/POSIX locale rules.
175+
*/
176+
staticinlineunsignedchar
177+
pg_ascii_toupper(unsignedcharch)
178+
{
179+
if (ch >='a'&&ch <='z')
180+
ch+='A'-'a';
181+
returnch;
182+
}
183+
184+
/*
185+
* Fold a character to lower case, following C/POSIX locale rules.
186+
*/
187+
staticinlineunsignedchar
188+
pg_ascii_tolower(unsignedcharch)
189+
{
190+
if (ch >='A'&&ch <='Z')
191+
ch+='a'-'A';
192+
returnch;
193+
}
194+
174195

175196
/*
176197
* Beginning in v12, we always replace snprintf() and friends with our own

‎src/port/pgstrcasecmp.c‎

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,6 @@
1313
*
1414
* NB: this code should match downcase_truncate_identifier() in scansup.c.
1515
*
16-
* We also provide strict ASCII-only case conversion functions, which can
17-
* be used to implement C/POSIX case folding semantics no matter what the
18-
* C library thinks the locale is.
19-
*
2016
*
2117
* Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group
2218
*
@@ -127,25 +123,3 @@ pg_tolower(unsigned char ch)
127123
ch=tolower(ch);
128124
returnch;
129125
}
130-
131-
/*
132-
* Fold a character to upper case, following C/POSIX locale rules.
133-
*/
134-
unsignedchar
135-
pg_ascii_toupper(unsignedcharch)
136-
{
137-
if (ch >='a'&&ch <='z')
138-
ch+='A'-'a';
139-
returnch;
140-
}
141-
142-
/*
143-
* Fold a character to lower case, following C/POSIX locale rules.
144-
*/
145-
unsignedchar
146-
pg_ascii_tolower(unsignedcharch)
147-
{
148-
if (ch >='A'&&ch <='Z')
149-
ch+='a'-'A';
150-
returnch;
151-
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp