cpython/Python/strdup.c
Pablo Galindo f2cf1e3e28
bpo-36623: Clean parser headers and include files (GH-12253)
After the removal of pgen, multiple header and function prototypes that lack implementation or are unused are still lying around.
2019-04-13 17:05:14 +01:00

13 lines
251 B
C

/* strdup() replacement (from stdwin, if you must know) */
char *
strdup(const char *str)
{
if (str != NULL) {
char *copy = malloc(strlen(str) + 1);
if (copy != NULL)
return strcpy(copy, str);
}
return NULL;
}