summaryrefslogtreecommitdiffstats
path: root/libc/string/strdup.c
diff options
context:
space:
mode:
author"Steven J. Hill" <sjhill@realitydiluted.com>2006-01-07 02:32:27 +0000
committer"Steven J. Hill" <sjhill@realitydiluted.com>2006-01-07 02:32:27 +0000
commite523bd15353350c3480b8a1820a0944b0fa8212e (patch)
tree60485116f9c62c306bb753f12f9d4eb79d16aa4e /libc/string/strdup.c
parent3b3434516a3415d7e0f4e1d50c553876dcb337b2 (diff)
downloaduClibc-alpine-e523bd15353350c3480b8a1820a0944b0fa8212e.tar.bz2
uClibc-alpine-e523bd15353350c3480b8a1820a0944b0fa8212e.tar.xz
Big fricking merge from trunk.
Diffstat (limited to 'libc/string/strdup.c')
-rw-r--r--libc/string/strdup.c33
1 files changed, 24 insertions, 9 deletions
diff --git a/libc/string/strdup.c b/libc/string/strdup.c
index 2bf2462fb..e2ccead9d 100644
--- a/libc/string/strdup.c
+++ b/libc/string/strdup.c
@@ -1,19 +1,34 @@
/*
+ * Copyright (C) 2002 Manuel Novoa III
* Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
*
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#define L_strdup
-#define Wstrdup __strdup
+#include "_string.h"
+#include <stdlib.h>
-#undef Wstrlen
-#undef Wstrcpy
-#define Wstrlen __strlen
-#define Wstrcpy __strcpy
+#ifdef WANT_WIDE
+# define __Wstrdup __wcsdup
+# define Wstrdup wcsdup
+# define Wstrlen __wcslen
+# define Wstrcpy __wcscpy
+#else
+# define __Wstrdup __strdup
+# define Wstrdup strdup
+# define Wstrlen __strlen
+# define Wstrcpy __strcpy
+#endif
-#include "wstring.c"
+Wchar attribute_hidden *__Wstrdup(register const Wchar *s1)
+{
+ register Wchar *s;
-strong_alias(__strdup, strdup)
+ if ((s = malloc((Wstrlen(s1) + 1) * sizeof(Wchar))) != NULL) {
+ Wstrcpy(s, s1);
+ }
-#undef L_strdup
+ return s;
+}
+
+strong_alias(__Wstrdup,Wstrdup)