]> Savannah Git Hosting - gnulib.git/commit
nl_langinfo: Make multithread-safe on Solaris 10 and Solaris 11.3.
authorBruno Haible <bruno@clisp.org>
Sat, 19 Sep 2020 10:37:14 +0000 (12:37 +0200)
committerBruno Haible <bruno@clisp.org>
Sat, 19 Sep 2020 10:37:14 +0000 (12:37 +0200)
commit3d87a9ada8e2cf75cac9d969d76c5f2ac0b9b38d
tree4860971456e082208c11fbbd74ca58142d55de28
parent875dff5812cb9de949727e1aa399a06b07a886a9
nl_langinfo: Make multithread-safe on Solaris 10 and Solaris 11.3.

Reported for Solaris 10 by Dagobert Michelsen via Paul Eggert in
<https://lists.gnu.org/archive/html/bug-gnulib/2020-01/msg00023.html>
and for Solaris 11.3 by Jeffrey Walton <noloader@gmail.com> in
<https://lists.gnu.org/archive/html/bug-grep/2020-06/msg00013.html>.

* lib/nl_langinfo-lock.c: New file, based on lib/setlocale_null-lock.c.
* lib/nl_langinfo.c: Include <stdlib.h> and <windows.h> or <pthread.h>
or <threads.h>.
(ITEMS, MAX_RESULT_LEN): New macros.
(nl_langinfo_unlocked): New function.
(gl_get_nl_langinfo_lock): New declaration.
(nl_langinfo_with_lock): New function, based on lib/setlocale_null.c.
(rpl_nl_langinfo): Use nl_langinfo_with_lock instead of nl_langinfo.
* m4/nl_langinfo.m4 (gl_FUNC_NL_LANGINFO): Require gl_PTHREADLIB. Define
HAVE_THREADS_H. Set NL_LANGINFO_MTSAFE. If setting it to 0, also set
REPLACE_NL_LANGINFO.
(gl_PREREQ_NL_LANGINFO_LOCK): New macro.
* modules/nl_langinfo (Files): Add lib/nl_langinfo-lock.c,
lib/windows-initguard.h, m4/threadlib.m4, m4/visibility.m4.
(configure.ac): Compile nl_langinfo-lock.c when NL_LANGINFO_MTSAFE is 0.
* doc/posix-functions/nl_langinfo.texi: Mention the Solaris bug.
ChangeLog
doc/posix-functions/nl_langinfo.texi
lib/nl_langinfo-lock.c [new file with mode: 0644]
lib/nl_langinfo.c
m4/nl_langinfo.m4
modules/nl_langinfo