Staging
v0.8.1
Revision c1004b85464579771db3b50f5b150449275bbbd0 authored by Łukasz Langa on 06 May 2019, 18:30:25 UTC, committed by Łukasz Langa on 06 May 2019, 18:30:25 UTC
1 parent f7b494c
Raw File
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