From 4abab5ad6c8465a7528ccdd5f49367da05f78bbd Mon Sep 17 00:00:00 2001 From: Vladimir Azarov Date: Tue, 1 Oct 2024 15:47:05 +0200 Subject: Initial version --- src/locale/newlocale.c | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 src/locale/newlocale.c (limited to 'src/locale/newlocale.c') diff --git a/src/locale/newlocale.c b/src/locale/newlocale.c new file mode 100644 index 0000000..9ac3cd3 --- /dev/null +++ b/src/locale/newlocale.c @@ -0,0 +1,70 @@ +#include +#include +#include +#include "locale_impl.h" +#include "lock.h" + +#define malloc __libc_malloc +#define calloc undef +#define realloc undef +#define free undef + +static int default_locale_init_done; +static struct __locale_struct default_locale, default_ctype_locale; + +int __loc_is_allocated(locale_t loc) +{ + return loc && loc != C_LOCALE && loc != UTF8_LOCALE + && loc != &default_locale && loc != &default_ctype_locale; +} + +static locale_t do_newlocale(int mask, const char *name, locale_t loc) +{ + struct __locale_struct tmp; + + for (int i=0; icat[i] : + __get_locale(i, (mask & (1<