Staging
v0.5.1
https://github.com/python/cpython
Revision c0db88f6abbace79644b2aca2290bf41b1a37174 authored by Miss Islington (bot) on 28 November 2019, 05:29:02 UTC, committed by GitHub on 28 November 2019, 05:29:02 UTC
(cherry picked from commit 02519f75d15b063914a11351da30178ca4ceb54b)

Co-authored-by: Tal Einat <taleinat+github@gmail.com>
1 parent d21b8e8
Raw File
Tip revision: c0db88f6abbace79644b2aca2290bf41b1a37174 authored by Miss Islington (bot) on 28 November 2019, 05:29:02 UTC
bpo-38524: clarify example a bit and improve formatting (GH-17406)
Tip revision: c0db88f
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