Staging
v0.5.1
Revision e3201094af2af2a9958333bd1cb212253941d644 authored by Łukasz Langa on 07 December 2020, 14:13:36 UTC, committed by Łukasz Langa on 07 December 2020, 14:13:36 UTC
1 parent a4e7d5f
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