summaryrefslogtreecommitdiffstats
path: root/libc-top-half/musl/src/locale/duplocale.c
diff options
context:
space:
mode:
Diffstat (limited to 'libc-top-half/musl/src/locale/duplocale.c')
-rw-r--r--libc-top-half/musl/src/locale/duplocale.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/libc-top-half/musl/src/locale/duplocale.c b/libc-top-half/musl/src/locale/duplocale.c
new file mode 100644
index 0000000..5ce33ae
--- /dev/null
+++ b/libc-top-half/musl/src/locale/duplocale.c
@@ -0,0 +1,20 @@
+#include <stdlib.h>
+#include <string.h>
+#include "locale_impl.h"
+#include "libc.h"
+
+#define malloc __libc_malloc
+#define calloc undef
+#define realloc undef
+#define free undef
+
+locale_t __duplocale(locale_t old)
+{
+ locale_t new = malloc(sizeof *new);
+ if (!new) return 0;
+ if (old == LC_GLOBAL_LOCALE) old = &libc.global_locale;
+ *new = *old;
+ return new;
+}
+
+weak_alias(__duplocale, duplocale);