https://github.com/python/cpython
Raw File
Tip revision: 3d8993a744813c5144851da5347d7b4b1885f234 authored by Ɓukasz Langa on 03 May 2021, 09:47:56 UTC
Python 3.8.10
Tip revision: 3d8993a
strdup.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;
}
back to top