diff options
author | "Steven J. Hill" <sjhill@realitydiluted.com> | 2007-01-21 02:24:07 +0000 |
---|---|---|
committer | "Steven J. Hill" <sjhill@realitydiluted.com> | 2007-01-21 02:24:07 +0000 |
commit | abfc5558bf4beb7dc381d93baaec4a9a3e4eba7b (patch) | |
tree | 8763531b221e50bbbafb457cc1688e9ab4175516 /libc/string/strdup.c | |
parent | 293cef1de02c36f58a48bcdbe2d385059ea04828 (diff) | |
download | uClibc-alpine-abfc5558bf4beb7dc381d93baaec4a9a3e4eba7b.tar.bz2 uClibc-alpine-abfc5558bf4beb7dc381d93baaec4a9a3e4eba7b.tar.xz |
More merging from trunk.
Diffstat (limited to 'libc/string/strdup.c')
-rw-r--r-- | libc/string/strdup.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/libc/string/strdup.c b/libc/string/strdup.c index dff5af60a..d15345d0d 100644 --- a/libc/string/strdup.c +++ b/libc/string/strdup.c @@ -10,25 +10,23 @@ #ifdef WANT_WIDE libc_hidden_proto(wcslen) -libc_hidden_proto(wcscpy) # define Wstrdup wcsdup # define Wstrlen wcslen -# define Wstrcpy wcscpy #else libc_hidden_proto(strdup) libc_hidden_proto(strlen) -libc_hidden_proto(strcpy) # define Wstrdup strdup # define Wstrlen strlen -# define Wstrcpy strcpy #endif +libc_hidden_proto(memcpy) Wchar *Wstrdup(register const Wchar *s1) { register Wchar *s; + register size_t l = (Wstrlen(s1) + 1) * sizeof(Wchar); - if ((s = malloc((Wstrlen(s1) + 1) * sizeof(Wchar))) != NULL) { - Wstrcpy(s, s1); + if ((s = malloc(l)) != NULL) { + memcpy(s, s1, l); } return s; |