3 #include "locale_impl.h"
6 locale_t __duplocale(locale_t old)
8 locale_t new = calloc(1, sizeof *new + LOCALE_NAME_MAX + 1);
10 new->messages_name = (void *)(new+1);
12 if (old == LC_GLOBAL_LOCALE) old = &libc.global_locale;
13 new->ctype_utf8 = old->ctype_utf8;
14 if (old->messages_name)
15 strcpy(new->messages_name, old->messages_name);
17 for (size_t i=0; i<sizeof new->cat/sizeof new->cat[0]; i++)
18 new->cat[i] = old->cat[i];
22 weak_alias(__duplocale, duplocale);