summaryrefslogtreecommitdiffstats
path: root/gl/setlocale_null.c
diff options
context:
space:
mode:
Diffstat (limited to 'gl/setlocale_null.c')
-rw-r--r--gl/setlocale_null.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/gl/setlocale_null.c b/gl/setlocale_null.c
index 29889642..39b6766c 100644
--- a/gl/setlocale_null.c
+++ b/gl/setlocale_null.c
@@ -1,5 +1,5 @@
1/* Query the name of the current global locale. 1/* Query the name of the current global locale.
2 Copyright (C) 2019-2025 Free Software Foundation, Inc. 2 Copyright (C) 2019-2026 Free Software Foundation, Inc.
3 3
4 This file is free software: you can redistribute it and/or modify 4 This file is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as 5 it under the terms of the GNU Lesser General Public License as
@@ -77,10 +77,9 @@ static int
77setlocale_null_r_with_lock (int category, char *buf, size_t bufsize) 77setlocale_null_r_with_lock (int category, char *buf, size_t bufsize)
78{ 78{
79 CRITICAL_SECTION *lock = gl_get_setlocale_null_lock (); 79 CRITICAL_SECTION *lock = gl_get_setlocale_null_lock ();
80 int ret;
81 80
82 EnterCriticalSection (lock); 81 EnterCriticalSection (lock);
83 ret = setlocale_null_r_unlocked (category, buf, bufsize); 82 int ret = setlocale_null_r_unlocked (category, buf, bufsize);
84 LeaveCriticalSection (lock); 83 LeaveCriticalSection (lock);
85 84
86 return ret; 85 return ret;
@@ -116,11 +115,10 @@ setlocale_null_r_with_lock (int category, char *buf, size_t bufsize)
116 if (pthread_in_use()) 115 if (pthread_in_use())
117 { 116 {
118 pthread_mutex_t *lock = gl_get_setlocale_null_lock (); 117 pthread_mutex_t *lock = gl_get_setlocale_null_lock ();
119 int ret;
120 118
121 if (pthread_mutex_lock (lock)) 119 if (pthread_mutex_lock (lock))
122 abort (); 120 abort ();
123 ret = setlocale_null_r_unlocked (category, buf, bufsize); 121 int ret = setlocale_null_r_unlocked (category, buf, bufsize);
124 if (pthread_mutex_unlock (lock)) 122 if (pthread_mutex_unlock (lock))
125 abort (); 123 abort ();
126 124
@@ -138,11 +136,10 @@ static int
138setlocale_null_r_with_lock (int category, char *buf, size_t bufsize) 136setlocale_null_r_with_lock (int category, char *buf, size_t bufsize)
139{ 137{
140 mtx_t *lock = gl_get_setlocale_null_lock (); 138 mtx_t *lock = gl_get_setlocale_null_lock ();
141 int ret;
142 139
143 if (mtx_lock (lock) != thrd_success) 140 if (mtx_lock (lock) != thrd_success)
144 abort (); 141 abort ();
145 ret = setlocale_null_r_unlocked (category, buf, bufsize); 142 int ret = setlocale_null_r_unlocked (category, buf, bufsize);
146 if (mtx_unlock (lock) != thrd_success) 143 if (mtx_unlock (lock) != thrd_success)
147 abort (); 144 abort ();
148 145
@@ -252,9 +249,7 @@ setlocale_null (int category)
252 i; 249 i;
253 char buf[SETLOCALE_NULL_MAX]; 250 char buf[SETLOCALE_NULL_MAX];
254 static char resultbuf[LC_INDICES_COUNT][SETLOCALE_NULL_MAX]; 251 static char resultbuf[LC_INDICES_COUNT][SETLOCALE_NULL_MAX];
255 int err; 252 int err = setlocale_null_r (category, buf, sizeof (buf));
256
257 err = setlocale_null_r (category, buf, sizeof (buf));
258 if (err == EINVAL) 253 if (err == EINVAL)
259 return NULL; 254 return NULL;
260 if (err) 255 if (err)