1#include "libc.h" 2#include "locale_impl.h" 3#include "threads_impl.h" 4 5locale_t __uselocale(locale_t new) { 6 thrd_t self = __thrd_current(); 7 locale_t old = self->locale; 8 locale_t global = &libc.global_locale; 9 10 if (new) 11 self->locale = new == LC_GLOBAL_LOCALE ? global : new; 12 13 return old == global ? LC_GLOBAL_LOCALE : old; 14} 15 16weak_alias(__uselocale, uselocale); 17