2021-05-09 17:34:00 +02:00
|
|
|
#include <string.h>
|
|
|
|
#include <stdlib.h>
|
2020-09-17 19:27:01 +02:00
|
|
|
|
2021-05-23 17:48:43 +02:00
|
|
|
char *strdup(char const *s)
|
2020-09-17 19:27:01 +02:00
|
|
|
{
|
2021-05-23 17:48:43 +02:00
|
|
|
size_t len = strlen(s) + 1;
|
|
|
|
char *copy = malloc(len);
|
|
|
|
if(copy) memcpy(copy, s, len);
|
|
|
|
return copy;
|
2020-09-17 19:27:01 +02:00
|
|
|
}
|