aboutsummaryrefslogtreecommitdiff
path: root/src/port/pgstrcasecmp.c
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>2005-12-25 02:14:19 +0000
committerBruce Momjian <bruce@momjian.us>2005-12-25 02:14:19 +0000
commit261114a23f51c3d35a50ac27f2f453c6767bfeff (patch)
treebe7be693d6fe6782a4f1535fa3b05cb2e76cb363 /src/port/pgstrcasecmp.c
parenta4d69a410d9690340456c11dec5be1200ce760b7 (diff)
downloadpostgresql-261114a23f51c3d35a50ac27f2f453c6767bfeff.tar.gz
postgresql-261114a23f51c3d35a50ac27f2f453c6767bfeff.zip
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.
Diffstat (limited to 'src/port/pgstrcasecmp.c')
-rw-r--r--src/port/pgstrcasecmp.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/port/pgstrcasecmp.c b/src/port/pgstrcasecmp.c
index b6680154767..9feb573f6c0 100644
--- a/src/port/pgstrcasecmp.c
+++ b/src/port/pgstrcasecmp.c
@@ -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;
}