Staging
v0.8.1
Revision 08bd63da6e64c49130d244ecf8f246089b9c5d9f authored by Łukasz Langa on 07 September 2020, 15:52:19 UTC, committed by Łukasz Langa on 07 September 2020, 15:52:19 UTC
1 parent 84105cb
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