https://github.com/python/cpython
Raw File
Tip revision: e1ebdc52b8bd82a928398b0a75149552a723389a authored by roy reznik on 11 April 2022, 15:10:34 UTC
gh-91423: Remove bugs.python.org from bugs.rst (GH-91425)
Tip revision: e1ebdc5
strdup.c
/* strdup() replacement (from stdwin, if you must know) */

#include "pgenheaders.h"

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