Staging
v0.5.1
https://github.com/python/cpython
Raw File
Tip revision: 75a402a2176c3baa5f48aa0e176507f1bac20cda authored by Ned Deily on 11 December 2018, 21:46:13 UTC
3.7.2rc1
Tip revision: 75a402a
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