1
0
mirror of https://github.com/postgres/postgres.git synced 2025-12-10 14:22:35 +03:00

Make PGLC_setlocale() static, and document that it can't be used safely

for any other purpose than PGLC_localeconv()'s internal save/restore of
locale settings.  Fix cash.c to call PGLC_localeconv() rather than
making a direct call to localeconv() --- the old way, if PGLC_localeconv()
had already cached a locale result, it would be overwritten by the first
cash_in or cash_out operation, leading to wrong-locale results later.
Probably no demonstrable bug today, since we only appear to be looking
at the LC_MONETARY results which should be the same anyway, but definitely
a gotcha waiting to strike.
This commit is contained in:
Tom Lane
2000-11-25 22:43:08 +00:00
parent 74dc04a034
commit e3269cab31
3 changed files with 64 additions and 53 deletions

View File

@@ -1,14 +1,13 @@
/* -----------------------------------------------------------------------
* pg_locale.h
*
* $Header: /cvsroot/pgsql/src/include/utils/pg_locale.h,v 1.4 2000/04/12 17:16:55 momjian Exp $
* The PostgreSQL locale utils.
*
*
* $Id: pg_locale.h,v 1.5 2000/11/25 22:43:07 tgl Exp $
*
* Portions Copyright (c) 1999-2000, PostgreSQL, Inc
*
* The PostgreSQL locale utils.
*
* Karel Zak - Zakkr
*
* -----------------------------------------------------------------------
@@ -35,13 +34,13 @@ typedef struct PG_LocaleCategories
} PG_LocaleCategories;
extern PG_LocaleCategories *PGLC_current(PG_LocaleCategories * lc);
extern PG_LocaleCategories *PGLC_setlocale(PG_LocaleCategories * lc);
extern void PGLC_current(PG_LocaleCategories * lc);
/*------
* Return the POSIX lconv struct (contains number/money formatting information)
* with locale information for *all* categories. Returned lconv is *independent*
* on current locale catogories setting - in contrast to standard localeconv().
* with locale information for all categories. Note that returned lconv
* does not depend on currently active category settings, but on external
* environment variables for locale.
*------
*/
extern struct lconv *PGLC_localeconv(void);