projects
/
musl
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fix x32 unistd macros to report as ILP32 not LP64
[musl]
/
src
/
locale
/
duplocale.c
diff --git
a/src/locale/duplocale.c
b/src/locale/duplocale.c
index
5f01e13
..
030b64c
100644
(file)
--- a/
src/locale/duplocale.c
+++ b/
src/locale/duplocale.c
@@
-1,11
+1,15
@@
#include <stdlib.h>
#include <string.h>
#include "locale_impl.h"
#include <stdlib.h>
#include <string.h>
#include "locale_impl.h"
+#include "libc.h"
-locale_t duplocale(locale_t old)
+locale_t
__
duplocale(locale_t old)
{
{
- locale_t new;
- new = calloc(1, sizeof *new);
- if (new && old != LC_GLOBAL_LOCALE) memcpy(new, old, sizeof *new);
+ locale_t new = malloc(sizeof *new);
+ if (!new) return 0;
+ if (old == LC_GLOBAL_LOCALE) old = &libc.global_locale;
+ *new = *old;
return new;
}
return new;
}
+
+weak_alias(__duplocale, duplocale);