pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Thomas Munro <tmunro@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Use thread-safe nl_langinfo_l(), not nl_langinfo().
Date: Tue, 13 Aug 2024 10:36:14 +0000
Message-ID: <E1sdosw-003ycn-Rd@gemulon.postgresql.org> (raw)

Use thread-safe nl_langinfo_l(), not nl_langinfo().

This gets rid of some setlocale() calls.  The remaining call to
setlocale() in pg_get_encoding_from_locale() is a query of the name
of the current locale when none was provided (in a multi-threaded future
that would need more work).

All known non-Windows targets have nl_langinfo_l(), from POSIX 2008, and
for Windows we already do something thread-safe.

Reviewed-by: Heikki Linnakangas <hlinnaka@iki.fi>
Discussion: https://postgr.es/m/CA%2BhUKGJqVe0%2BPv9dvC9dSums_PXxGo9SWcxYAMBguWJUGbWz-A%40mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/35eeea62302260ec07fd11b287e488768d4543e2

Modified Files
--------------
src/port/chklocale.c | 67 +++++++++++++++-------------------------------------
1 file changed, 19 insertions(+), 48 deletions(-)



Message-ID: <E1sdosw-003ycn-Rd@gemulon.postgresql.org>
Permalink:  ../E1sdosw-003ycn-Rd@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1sdosw-003ycn-Rd@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: tmunro@postgresql.org, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Use thread-safe nl_langinfo_l(), not nl_langinfo().
  In-Reply-To: <E1sdosw-003ycn-Rd@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox