Commit 5d7f6993 authored by Tom Lane's avatar Tom Lane

Use (unsigned char) cast in argument of pg_tolower(). Maybe it works on

Windows without that, but we shouldn't put bad examples where people might
copy them.  Also, reformat slightly to improve the odds that pgindent
won't go nuts on this.
parent 1b2bb33a
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/port/path.c,v 1.77 2009/04/03 11:52:08 mha Exp $ * $PostgreSQL: pgsql/src/port/path.c,v 1.78 2009/04/03 23:27:17 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -420,20 +420,22 @@ get_progname(const char *argv0) ...@@ -420,20 +420,22 @@ get_progname(const char *argv0)
/* /*
* dir_strcmp: strcmp except any two DIR_SEP characters are considered equal * dir_strcmp: strcmp except any two DIR_SEP characters are considered equal,
* and we honor filesystem case insensitivity if known
*/ */
static int static int
dir_strcmp(const char *s1, const char *s2) dir_strcmp(const char *s1, const char *s2)
{ {
while (*s1 && *s2) while (*s1 && *s2)
{ {
if (
#ifndef WIN32 #ifndef WIN32
if (*s1 != *s2 && *s1 != *s2
#else #else
/* On windows, paths are case-insensitive */ /* On windows, paths are case-insensitive */
if (pg_tolower(*s1) != pg_tolower(*s2) && pg_tolower((unsigned char) *s1) != pg_tolower((unsigned char) *s2)
#endif #endif
!(IS_DIR_SEP(*s1) && IS_DIR_SEP(*s2))) && !(IS_DIR_SEP(*s1) && IS_DIR_SEP(*s2)))
return (int) *s1 - (int) *s2; return (int) *s1 - (int) *s2;
s1++, s2++; s1++, s2++;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment