]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/l4re-core/uclibc/lib/contrib/uclibc/libc/string/strdup.c
Update
[l4.git] / l4 / pkg / l4re-core / uclibc / lib / contrib / uclibc / libc / string / strdup.c
1 /*
2  * Copyright (C) 2002     Manuel Novoa III
3  * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
4  *
5  * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
6  */
7
8 #include "_string.h"
9 #include <stdlib.h>
10
11 #ifdef WANT_WIDE
12 # define Wstrdup wcsdup
13 # define Wstrlen wcslen
14 #else
15 # define Wstrdup strdup
16 # define Wstrlen strlen
17 #endif
18
19 Wchar *Wstrdup(register const Wchar *s1)
20 {
21         register Wchar *s;
22         register size_t l = (Wstrlen(s1) + 1) * sizeof(Wchar);
23
24         if ((s = malloc(l)) != NULL) {
25                 memcpy(s, s1, l);
26         }
27
28         return s;
29 }
30
31 #ifndef WANT_WIDE
32 libc_hidden_weak(strdup)
33 #endif