]>
git.proxmox.com Git - wasi-libc.git/blob - libc-top-half/musl/src/locale/uselocale.c
1 #include "locale_impl.h"
2 #if defined(__wasilibc_unmodified_upstream) || defined(_REENTRANT)
3 #include "pthread_impl.h"
7 locale_t
__uselocale(locale_t
new)
9 #if defined(__wasilibc_unmodified_upstream) || defined(_REENTRANT)
10 pthread_t self
= __pthread_self();
11 locale_t old
= self
->locale
;
13 locale_t old
= &libc
.global_locale
;
15 locale_t global
= &libc
.global_locale
;
17 #if defined(__wasilibc_unmodified_upstream) || defined(_REENTRANT)
18 if (new) self
->locale
= new == LC_GLOBAL_LOCALE
? global
: new;
20 if (new != NULL
&& new != global
&& new != LC_GLOBAL_LOCALE
) {
21 fputs("non-global locale not supported yet", stderr
);
26 return old
== global
? LC_GLOBAL_LOCALE
: old
;
29 weak_alias(__uselocale
, uselocale
);