summaryrefslogtreecommitdiff
path: root/libc/string/strdup.c
diff options
context:
space:
mode:
authorPeter S. Mazinger <ps.m@gmx.net>2006-01-03 14:50:18 +0000
committerPeter S. Mazinger <ps.m@gmx.net>2006-01-03 14:50:18 +0000
commit167d5e33fcb821e51e2f9dcf460591737c3c7972 (patch)
tree79acefdd8c9781098adbf77278415eda6365fd3d /libc/string/strdup.c
parentfe68563b9a070fedf117c8738652587945427bb3 (diff)
Complete split of all the string functions. Hope haven't broken too much. wcscoll/strcoll needs some love ...
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)