v6.1-0004-fixup-Provide-thread-safe-pg_localeconv_r.patch

text/plain

Filename: v6.1-0004-fixup-Provide-thread-safe-pg_localeconv_r.patch
Type: text/plain
Part: 3
Message: Re: Thread-safe nl_langinfo() and localeconv()

Patch

Format: format-patch
Series: patch v6-0004
Subject: fixup! Provide thread-safe pg_localeconv_r().
File+
configure 1 1
configure.ac 1 1
src/port/pg_localeconv_r.c 5 5
From 14b0d95ab7ec01aa5e65f56aea516e13b1f44789 Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <peter@eisentraut.org>
Date: Fri, 14 Feb 2025 14:30:17 +0100
Subject: [PATCH v6.1 4/5] fixup! Provide thread-safe pg_localeconv_r().

NOTE: Also remove the disucssion about _configthreadlocale() from the
commit message, since that was already done earlier.
---
 configure                  |  2 +-
 configure.ac               |  2 +-
 src/port/pg_localeconv_r.c | 10 +++++-----
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/configure b/configure
index 3e7c5fc91d6..f5f82b29b43 100755
--- a/configure
+++ b/configure
@@ -14934,7 +14934,7 @@ fi
 LIBS_including_readline="$LIBS"
 LIBS=`echo "$LIBS" | sed -e 's/-ledit//g' -e 's/-lreadline//g'`
 
-for ac_func in backtrace_symbols copyfile copy_file_range elf_aux_info getauxval getifaddrs getpeerucred inet_pton localeconv_l kqueue mbstowcs_l memset_s posix_fallocate ppoll pthread_is_threaded_np setproctitle setproctitle_fast strchrnul strsignal syncfs sync_file_range uselocale wcstombs_l
+for ac_func in backtrace_symbols copyfile copy_file_range elf_aux_info getauxval getifaddrs getpeerucred inet_pton kqueue localeconv_l mbstowcs_l memset_s posix_fallocate ppoll pthread_is_threaded_np setproctitle setproctitle_fast strchrnul strsignal syncfs sync_file_range uselocale wcstombs_l
 do :
   as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
 ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
diff --git a/configure.ac b/configure.ac
index e56136049e9..0017d590868 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1710,8 +1710,8 @@ AC_CHECK_FUNCS(m4_normalize([
 	getifaddrs
 	getpeerucred
 	inet_pton
-	localeconv_l
 	kqueue
+	localeconv_l
 	mbstowcs_l
 	memset_s
 	posix_fallocate
diff --git a/src/port/pg_localeconv_r.c b/src/port/pg_localeconv_r.c
index efb98cd127d..ec5cd4ef1cc 100644
--- a/src/port/pg_localeconv_r.c
+++ b/src/port/pg_localeconv_r.c
@@ -55,7 +55,7 @@ struct lconv_member_info
  * The work of populating lconv objects is driven by this table.  Since we
  * tolerate non-matching encodings in LC_NUMERIC and LC_MONETARY, we have to
  * call the underlying OS routine multiple times, with the correct locales.
- * The first column of this table says which locale applies to each struct
+ * The first column of this table says which locale category applies to each struct
  * member.  The second column is the name of the struct member.  The third
  * column is the name of the nl_item, if translating from nl_langinfo_l() (it's
  * always the member name, in upper case).
@@ -146,7 +146,7 @@ pg_localeconv_from_langinfo(struct lconv *dst,
 
 	return 0;
 }
-#else
+#else							/* not TRANSLATE_FROM_LANGINFO */
 /*
  * Copy members from a given category.  Note that you have to call this twice
  * to copy the LC_MONETARY and then LC_NUMERIC members.
@@ -182,7 +182,7 @@ pg_localeconv_copy_members(struct lconv *dst,
 
 	return 0;
 }
-#endif
+#endif							/* not TRANSLATE_FROM_LANGINFO */
 
 /*
  * A thread-safe routine to get a copy of the lconv struct for a given
@@ -294,7 +294,7 @@ pg_localeconv_r(const char *lc_monetary,
 
 	return result;
 
-#else
+#else							/* !WIN32 */
 	locale_t	monetary_locale;
 	locale_t	numeric_locale;
 	int			result;
@@ -363,5 +363,5 @@ pg_localeconv_r(const char *lc_monetary,
 	freelocale(numeric_locale);
 
 	return result;
-#endif
+#endif							/* !WIN32 */
 }
-- 
2.48.1