#undef setlocale
static const char *
-setlocale_null_androidfix (int category)
+setlocale_null_unlocked (int category)
{
const char *result = setlocale (category, NULL);
}
static int
-setlocale_null_unlocked (int category, char *buf, size_t bufsize)
+setlocale_null_r_unlocked (int category, char *buf, size_t bufsize)
{
#if defined _WIN32 && !defined __CYGWIN__ && defined _MSC_VER
/* On native Windows, nowadays, the setlocale() implementation is based
}
}
#else
- const char *result = setlocale_null_androidfix (category);
+ const char *result = setlocale_null_unlocked (category);
if (result == NULL)
{
#if !(SETLOCALE_NULL_ALL_MTSAFE && SETLOCALE_NULL_ONE_MTSAFE) /* musl libc, macOS, FreeBSD, NetBSD, OpenBSD, AIX, Haiku, Cygwin < 3.4.6 */
-/* Use a lock, so that no two threads can invoke setlocale_null_unlocked
+/* Use a lock, so that no two threads can invoke setlocale_null_r_unlocked
at the same time. */
/* Prohibit renaming this symbol. */
# if AVOID_ANY_THREADS
/* The option '--disable-threads' explicitly requests no locking. */
-# define setlocale_null_with_lock setlocale_null_unlocked
+# define setlocale_null_r_with_lock setlocale_null_r_unlocked
# elif defined _WIN32 && !defined __CYGWIN__
extern __declspec(dllimport) CRITICAL_SECTION *gl_get_setlocale_null_lock (void);
static int
-setlocale_null_with_lock (int category, char *buf, size_t bufsize)
+setlocale_null_r_with_lock (int category, char *buf, size_t bufsize)
{
CRITICAL_SECTION *lock = gl_get_setlocale_null_lock ();
int ret;
EnterCriticalSection (lock);
- ret = setlocale_null_unlocked (category, buf, bufsize);
+ ret = setlocale_null_r_unlocked (category, buf, bufsize);
LeaveCriticalSection (lock);
return ret;
# endif
static int
-setlocale_null_with_lock (int category, char *buf, size_t bufsize)
+setlocale_null_r_with_lock (int category, char *buf, size_t bufsize)
{
if (pthread_in_use())
{
if (pthread_mutex_lock (lock))
abort ();
- ret = setlocale_null_unlocked (category, buf, bufsize);
+ ret = setlocale_null_r_unlocked (category, buf, bufsize);
if (pthread_mutex_unlock (lock))
abort ();
return ret;
}
else
- return setlocale_null_unlocked (category, buf, bufsize);
+ return setlocale_null_r_unlocked (category, buf, bufsize);
}
# elif HAVE_THREADS_H
extern mtx_t *gl_get_setlocale_null_lock (void);
static int
-setlocale_null_with_lock (int category, char *buf, size_t bufsize)
+setlocale_null_r_with_lock (int category, char *buf, size_t bufsize)
{
mtx_t *lock = gl_get_setlocale_null_lock ();
int ret;
if (mtx_lock (lock) != thrd_success)
abort ();
- ret = setlocale_null_unlocked (category, buf, bufsize);
+ ret = setlocale_null_r_unlocked (category, buf, bufsize);
if (mtx_unlock (lock) != thrd_success)
abort ();
#if SETLOCALE_NULL_ALL_MTSAFE
# if SETLOCALE_NULL_ONE_MTSAFE
- return setlocale_null_unlocked (category, buf, bufsize);
+ return setlocale_null_r_unlocked (category, buf, bufsize);
# else
if (category == LC_ALL)
- return setlocale_null_unlocked (category, buf, bufsize);
+ return setlocale_null_r_unlocked (category, buf, bufsize);
else
- return setlocale_null_with_lock (category, buf, bufsize);
+ return setlocale_null_r_with_lock (category, buf, bufsize);
# endif
#else
# if SETLOCALE_NULL_ONE_MTSAFE
if (category == LC_ALL)
- return setlocale_null_with_lock (category, buf, bufsize);
+ return setlocale_null_r_with_lock (category, buf, bufsize);
else
- return setlocale_null_unlocked (category, buf, bufsize);
+ return setlocale_null_r_unlocked (category, buf, bufsize);
# else
- return setlocale_null_with_lock (category, buf, bufsize);
+ return setlocale_null_r_with_lock (category, buf, bufsize);
# endif
#endif
setlocale_null (int category)
{
#if SETLOCALE_NULL_ALL_MTSAFE && SETLOCALE_NULL_ONE_MTSAFE
- return setlocale_null_androidfix (category);
+ return setlocale_null_unlocked (category);
#else
/* This call must be multithread-safe. To achieve this without using
if (category == LC_ALL)
{
# if SETLOCALE_NULL_ALL_MTSAFE
- return setlocale_null_androidfix (LC_ALL);
+ return setlocale_null_unlocked (LC_ALL);
# else
char buf[SETLOCALE_NULL_ALL_MAX];
static char resultbuf[SETLOCALE_NULL_ALL_MAX];
else
{
# if SETLOCALE_NULL_ONE_MTSAFE
- return setlocale_null_androidfix (category);
+ return setlocale_null_unlocked (category);
# else
enum
{