https://github.com/python/cpython
Raw File
Tip revision: 60918d510ee0d287f05c6efc0d6aee8df7a1d16a authored by Serhiy Storchaka on 27 November 2018, 19:34:27 UTC
bpo-33012: Fix more invalid function cast warnings with gcc 8. (GH-10751)
Tip revision: 60918d5
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