Files
photon/libc/string/strdup.c

12 lines
199 B
C
Raw Normal View History

2020-07-16 14:02:51 +01:00
#include <string.h>
#include <stdlib.h>
char *strdup(const char *str)
{
size_t len = strlen(str);
char *out = malloc(len + 1);
memcpy(out, str, len);
out[len] = 0;
return out;
}