https://github.com/python/cpython
Raw File
Tip revision: dfad352267cee3ea581035622a7371bc3b235378 authored by Ned Deily on 12 June 2018, 04:46:50 UTC
3.7.0rc1
Tip revision: dfad352
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