diff options
| author | Tom Lane | 2004-05-07 00:24:59 +0000 |
|---|---|---|
| committer | Tom Lane | 2004-05-07 00:24:59 +0000 |
| commit | 0bd61548ab8d1ac5fee63f48ee9b384502a51ad6 (patch) | |
| tree | b0c63b75585d0c396e67a3acd204e226b13eae4b /src/interfaces/libpq | |
| parent | 4d46274b33db52618ccf49550213b4d5ce4a7981 (diff) | |
Solve the 'Turkish problem' with undesirable locale behavior for case
conversion of basic ASCII letters. Remove all uses of strcasecmp and
strncasecmp in favor of new functions pg_strcasecmp and pg_strncasecmp;
remove most but not all direct uses of toupper and tolower in favor of
pg_toupper and pg_tolower. These functions use the same notions of
case folding already developed for identifier case conversion. I left
the straight locale-based folding in place for situations where we are
just manipulating user data and not trying to match it to built-in
strings --- for example, the SQL upper() function is still locale
dependent. Perhaps this will prove not to be what's wanted, but at
the moment we can initdb and pass regression tests in Turkish locale.
Diffstat (limited to 'src/interfaces/libpq')
| -rw-r--r-- | src/interfaces/libpq/Makefile | 8 | ||||
| -rw-r--r-- | src/interfaces/libpq/fe-exec.c | 5 | ||||
| -rw-r--r-- | src/interfaces/libpq/fe-protocol2.c | 4 | ||||
| -rw-r--r-- | src/interfaces/libpq/fe-protocol3.c | 4 | ||||
| -rw-r--r-- | src/interfaces/libpq/fe-secure.c | 4 | ||||
| -rw-r--r-- | src/interfaces/libpq/win32.h | 9 |
6 files changed, 13 insertions, 21 deletions
diff --git a/src/interfaces/libpq/Makefile b/src/interfaces/libpq/Makefile index 2c8a4fcf71c..3a5a4f99757 100644 --- a/src/interfaces/libpq/Makefile +++ b/src/interfaces/libpq/Makefile @@ -4,7 +4,7 @@ # # Copyright (c) 1994, Regents of the University of California # -# $PostgreSQL: pgsql/src/interfaces/libpq/Makefile,v 1.103 2004/04/25 20:57:32 momjian Exp $ +# $PostgreSQL: pgsql/src/interfaces/libpq/Makefile,v 1.104 2004/05/07 00:24:59 tgl Exp $ # #------------------------------------------------------------------------- @@ -24,7 +24,7 @@ override CFLAGS += $(PTHREAD_CFLAGS) OBJS= fe-auth.o fe-connect.o fe-exec.o fe-misc.o fe-print.o fe-lobj.o \ fe-protocol2.o fe-protocol3.o pqexpbuffer.o pqsignal.o fe-secure.o \ dllist.o md5.o ip.o wchar.o encnames.o \ - $(filter crypt.o getaddrinfo.o inet_aton.o noblock.o snprintf.o strerror.o open.o path.o thread.o, $(LIBOBJS)) + $(filter crypt.o getaddrinfo.o inet_aton.o noblock.o pgstrcasecmp.o snprintf.o strerror.o open.o path.o thread.o, $(LIBOBJS)) ifeq ($(PORTNAME), win32) OBJS+=win32.o endif @@ -53,7 +53,7 @@ backend_src = $(top_srcdir)/src/backend # For port modules, this only happens if configure decides the module # is needed (see filter hack in OBJS, above). -crypt.c getaddrinfo.c inet_aton.c noblock.c snprintf.c strerror.c open.c path.c thread.c: % : $(top_srcdir)/src/port/% +crypt.c getaddrinfo.c inet_aton.c noblock.c pgstrcasecmp.c snprintf.c strerror.c open.c path.c thread.c: % : $(top_srcdir)/src/port/% rm -f $@ && $(LN_S) $< . md5.c ip.c: % : $(backend_src)/libpq/% @@ -79,4 +79,4 @@ uninstall: uninstall-lib rm -f $(DESTDIR)$(includedir)/libpq-fe.h $(DESTDIR)$(includedir_internal)/libpq-int.h $(DESTDIR)$(includedir_internal)/pqexpbuffer.h clean distclean maintainer-clean: clean-lib - rm -f $(OBJS) crypt.c getaddrinfo.c inet_aton.c noblock.c snprintf.c strerror.c open.c path.c thread.c dllist.c md5.c ip.c encnames.c wchar.c + rm -f $(OBJS) crypt.c getaddrinfo.c inet_aton.c noblock.c pgstrcasecmp.c snprintf.c strerror.c open.c path.c thread.c dllist.c md5.c ip.c encnames.c wchar.c diff --git a/src/interfaces/libpq/fe-exec.c b/src/interfaces/libpq/fe-exec.c index 6e8c2153e0a..1da5bc1ad65 100644 --- a/src/interfaces/libpq/fe-exec.c +++ b/src/interfaces/libpq/fe-exec.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/interfaces/libpq/fe-exec.c,v 1.158 2004/03/14 22:00:54 tgl Exp $ + * $PostgreSQL: pgsql/src/interfaces/libpq/fe-exec.c,v 1.159 2004/05/07 00:24:59 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -1904,8 +1904,7 @@ PQfnumber(const PGresult *res, const char *field_name) } else { - if (isupper((unsigned char) c)) - c = tolower((unsigned char) c); + c = pg_tolower((unsigned char) c); *optr++ = c; } } diff --git a/src/interfaces/libpq/fe-protocol2.c b/src/interfaces/libpq/fe-protocol2.c index 369481b3386..0101c169085 100644 --- a/src/interfaces/libpq/fe-protocol2.c +++ b/src/interfaces/libpq/fe-protocol2.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/interfaces/libpq/fe-protocol2.c,v 1.10 2004/03/05 01:53:59 tgl Exp $ + * $PostgreSQL: pgsql/src/interfaces/libpq/fe-protocol2.c,v 1.11 2004/05/07 00:24:59 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -117,7 +117,7 @@ pqSetenvPoll(PGconn *conn) if ((val = getenv(conn->next_eo->envName))) { - if (strcasecmp(val, "default") == 0) + if (pg_strcasecmp(val, "default") == 0) sprintf(setQuery, "SET %s = DEFAULT", conn->next_eo->pgName); else diff --git a/src/interfaces/libpq/fe-protocol3.c b/src/interfaces/libpq/fe-protocol3.c index 1f9621a9b17..9969c589a02 100644 --- a/src/interfaces/libpq/fe-protocol3.c +++ b/src/interfaces/libpq/fe-protocol3.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/interfaces/libpq/fe-protocol3.c,v 1.12 2004/03/21 22:29:11 tgl Exp $ + * $PostgreSQL: pgsql/src/interfaces/libpq/fe-protocol3.c,v 1.13 2004/05/07 00:24:59 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -1471,7 +1471,7 @@ build_startup_packet(const PGconn *conn, char *packet, if ((val = getenv(next_eo->envName)) != NULL) { - if (strcasecmp(val, "default") != 0) + if (pg_strcasecmp(val, "default") != 0) { if (packet) strcpy(packet + packet_len, next_eo->pgName); diff --git a/src/interfaces/libpq/fe-secure.c b/src/interfaces/libpq/fe-secure.c index 83edb06c26e..ffdae2a519f 100644 --- a/src/interfaces/libpq/fe-secure.c +++ b/src/interfaces/libpq/fe-secure.c @@ -11,7 +11,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/interfaces/libpq/fe-secure.c,v 1.39 2004/03/27 03:08:42 tgl Exp $ + * $PostgreSQL: pgsql/src/interfaces/libpq/fe-secure.c,v 1.40 2004/05/07 00:24:59 tgl Exp $ * * NOTES * The client *requires* a valid server certificate. Since @@ -544,7 +544,7 @@ verify_peer(PGconn *conn) */ for (s = h->h_aliases; *s != NULL; s++) { - if (strcasecmp(conn->peer_cn, *s) == 0) + if (pg_strcasecmp(conn->peer_cn, *s) == 0) return 0; } diff --git a/src/interfaces/libpq/win32.h b/src/interfaces/libpq/win32.h index 350b350b48d..06fdfdded07 100644 --- a/src/interfaces/libpq/win32.h +++ b/src/interfaces/libpq/win32.h @@ -2,18 +2,11 @@ #define __win32_h_included /* - * strcasecmp() is not in Windows, stricmp is, though - */ -#define strcasecmp(a,b) stricmp(a,b) -#define strncasecmp(a,b,c) _strnicmp(a,b,c) - -/* - * Some other compat functions + * Some compatibility functions */ #ifdef __BORLANDC__ #define _timeb timeb #define _ftime(a) ftime(a) -#define _strnicmp(a,b,c) strnicmp(a,b,c) #define _errno errno #else /* open provided elsewhere */ |
