mirror of
https://github.com/postgres/postgres.git
synced 2025-07-05 07:21:24 +03:00
I have added these macros to c.h:
#define HIGHBIT (0x80) #define IS_HIGHBIT_SET(ch) ((unsigned char)(ch) & HIGHBIT) and removed CSIGNBIT and mapped it uses to HIGHBIT. I have also added uses for IS_HIGHBIT_SET where appropriate. This change is purely for code clarity.
This commit is contained in:
@ -16,7 +16,7 @@
|
||||
*
|
||||
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/port/pgstrcasecmp.c,v 1.5 2004/12/31 22:03:53 pgsql Exp $
|
||||
* $PostgreSQL: pgsql/src/port/pgstrcasecmp.c,v 1.6 2005/12/25 02:14:19 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -40,12 +40,12 @@ pg_strcasecmp(const char *s1, const char *s2)
|
||||
{
|
||||
if (ch1 >= 'A' && ch1 <= 'Z')
|
||||
ch1 += 'a' - 'A';
|
||||
else if (ch1 >= 0x80 && isupper(ch1))
|
||||
else if (IS_HIGHBIT_SET(ch1) && isupper(ch1))
|
||||
ch1 = tolower(ch1);
|
||||
|
||||
if (ch2 >= 'A' && ch2 <= 'Z')
|
||||
ch2 += 'a' - 'A';
|
||||
else if (ch2 >= 0x80 && isupper(ch2))
|
||||
else if (IS_HIGHBIT_SET(ch2) && isupper(ch2))
|
||||
ch2 = tolower(ch2);
|
||||
|
||||
if (ch1 != ch2)
|
||||
@ -73,12 +73,12 @@ pg_strncasecmp(const char *s1, const char *s2, size_t n)
|
||||
{
|
||||
if (ch1 >= 'A' && ch1 <= 'Z')
|
||||
ch1 += 'a' - 'A';
|
||||
else if (ch1 >= 0x80 && isupper(ch1))
|
||||
else if (IS_HIGHBIT_SET(ch1) && isupper(ch1))
|
||||
ch1 = tolower(ch1);
|
||||
|
||||
if (ch2 >= 'A' && ch2 <= 'Z')
|
||||
ch2 += 'a' - 'A';
|
||||
else if (ch2 >= 0x80 && isupper(ch2))
|
||||
else if (IS_HIGHBIT_SET(ch2) && isupper(ch2))
|
||||
ch2 = tolower(ch2);
|
||||
|
||||
if (ch1 != ch2)
|
||||
@ -102,7 +102,7 @@ pg_toupper(unsigned char ch)
|
||||
{
|
||||
if (ch >= 'a' && ch <= 'z')
|
||||
ch += 'A' - 'a';
|
||||
else if (ch >= 0x80 && islower(ch))
|
||||
else if (IS_HIGHBIT_SET(ch) && islower(ch))
|
||||
ch = toupper(ch);
|
||||
return ch;
|
||||
}
|
||||
@ -119,7 +119,7 @@ pg_tolower(unsigned char ch)
|
||||
{
|
||||
if (ch >= 'A' && ch <= 'Z')
|
||||
ch += 'a' - 'A';
|
||||
else if (ch >= 0x80 && isupper(ch))
|
||||
else if (IS_HIGHBIT_SET(ch) && isupper(ch))
|
||||
ch = tolower(ch);
|
||||
return ch;
|
||||
}
|
||||
|
Reference in New Issue
Block a user