mb support fix - Mailing list pgsql-hackers

From Tatsuo Ishii
Subject mb support fix
Date
Msg-id 199901270059.JAA25483@srapc451.sra.co.jp
Whole thread Raw
Responses Re: [PATCHES] mb support fix
List pgsql-hackers
Included patches fix a portability problem of unsetenv() used in
6.4.2 multi-byte support. unsetenv() is only avaliable on FreeBSD and
Linux so I decided to replace with putenv().
--
Tatsuo Ishii
t-ishii@sra.co.jp
----------------------------- cut here ----------------------------
*** postgresql-6.4.2/src/bin/psql/psql.c.orig    Wed Jan  6 13:25:45 1999
--- postgresql-6.4.2/src/bin/psql/psql.c    Wed Jan  6 13:26:27 1999
***************
*** 1498,1504 ****            PGCLIENTENCODING value. -- 1998/12/12 Tatsuo Ishii */                     if
(!has_client_encoding){
 
!             unsetenv("PGCLIENTENCODING");         } #endif 
--- 1498,1505 ----            PGCLIENTENCODING value. -- 1998/12/12 Tatsuo Ishii */                     if
(!has_client_encoding){
 
!                 static const char ev[] = "PGCLIENTENCODING=";
!             putenv(ev);         } #endif 
*** postgresql-6.4.2/src/interfaces/libpq/fe-print.c.orig    Wed Jan  6 13:27:21 1999
--- postgresql-6.4.2/src/interfaces/libpq/fe-print.c    Wed Jan  6 13:29:19 1999
***************
*** 506,512 ****     int            encoding = -1;      str = getenv("PGCLIENTENCODING");
!     if (str)         encoding = pg_char_to_encoding(str);     if (encoding < 0)         encoding = MULTIBYTE;
--- 506,512 ----     int            encoding = -1;      str = getenv("PGCLIENTENCODING");
!     if (str && *str != NULL)         encoding = pg_char_to_encoding(str);     if (encoding < 0)         encoding =
MULTIBYTE;
*** postgresql-6.4.2/src/interfaces/libpq/fe-connect.c.orig    Wed Jan  6 13:29:47 1999
--- postgresql-6.4.2/src/interfaces/libpq/fe-connect.c    Wed Jan  6 13:30:55 1999
***************
*** 813,819 **** #ifdef MULTIBYTE     /* query server encoding */     env = getenv(envname);
!     if (!env)     {         rtn = PQexec(conn, "select getdatabaseencoding()");         if (rtn &&
PQresultStatus(rtn)== PGRES_TUPLES_OK)
 
--- 813,819 ---- #ifdef MULTIBYTE     /* query server encoding */     env = getenv(envname);
!     if (!env || *env == NULL)     {         rtn = PQexec(conn, "select getdatabaseencoding()");         if (rtn &&
PQresultStatus(rtn)== PGRES_TUPLES_OK)
 


pgsql-hackers by date:

Previous
From: The Hermit Hacker
Date:
Subject: Re: alloca (was: Postgres Speed or lack thereof)
Next
From: The Hermit Hacker
Date:
Subject: Re: [PATCHES] mb support fix