source:
trunk/sys/dietlibc/strdup.c
@
  315
        
        | Last change on this file since 315 was 1, checked in by , 9 years ago | |
|---|---|
| File size: 176 bytes | |
| Line | |
|---|---|
| 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.
    