source:
trunk/sys/dietlibc/strdup.c
@
131
Last change on this file since 131 was 1, checked in by , 8 years ago | |
---|---|
File size: 176 bytes |
Rev | Line | |
---|---|---|
[1] | 1 | #include <string.h> |
2 | #include <stdlib.h> | |
3 | ||
4 | char *strdup(const char *s) { | |
5 | size_t l=strlen(s)+1; | |
6 | char *tmp=(char *)malloc(l); | |
7 | if (!tmp) return 0; | |
8 | return memcpy(tmp,s,l); | |
9 | } |
Note: See TracBrowser
for help on using the repository browser.