X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=src%2Flocale%2Fsetlocale.c;h=360c4437644b88f86ac8b9f0db5d92915019c8d7;hb=d055e6a45a17673b8dd3ec16e786bb2fe1700dd5;hp=11d823ce93997284450ae768d8c06139b574b159;hpb=5f12ffe1239a5e4f8d4e98e2dff4e191a71f4693;p=musl diff --git a/src/locale/setlocale.c b/src/locale/setlocale.c index 11d823ce..360c4437 100644 --- a/src/locale/setlocale.c +++ b/src/locale/setlocale.c @@ -7,23 +7,13 @@ static char buf[LC_ALL*(LOCALE_NAME_MAX+1)]; -static char *setlocale_one_unlocked(int cat, const char *name) -{ - const struct __locale_map *lm; - - if (name) libc.global_locale.cat[cat] = lm = __get_locale(cat, name); - else lm = libc.global_locale.cat[cat]; - - return lm ? (char *)lm->name : "C"; -} - char *setlocale(int cat, const char *name) { - static volatile int lock[1]; + const struct __locale_map *lm; if ((unsigned)cat > LC_ALL) return 0; - LOCK(lock); + LOCK(__locale_lock); /* For LC_ALL, setlocale is required to return a string which * encodes the current setting for all categories. The format of @@ -33,6 +23,7 @@ char *setlocale(int cat, const char *name) if (cat == LC_ALL) { int i; if (name) { + struct __locale_struct tmp_locale; char part[LOCALE_NAME_MAX+1] = "C.UTF-8"; const char *p = name; for (i=0; iname : "C"; - UNLOCK(lock); + UNLOCK(__locale_lock); return ret; }