https://github.com/python/cpython
Raw File
Tip revision: 376d66eb5080cf8076d767b0916c103463343963 authored by Ɓukasz Langa on 24 August 2023, 17:51:41 UTC
Python 3.9.18
Tip revision: 376d66e
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