aboutsummaryrefslogtreecommitdiff
path: root/src/mlibc/string/strdup.c
blob: 0cddd794c7ab83104f06ed2353aa3b9c6283ca3d (plain) (blame)
1
2
3
4
5
6
7
8
9
#include <mlibc/string.h>
#include <mlibc/stdlib.h>

char *strdup(const char *orig) {
    size_t s_orig = strlen(orig);
    char *ret = kmalloc(s_orig + 1);
    strcpy(ret, orig);
    return ret;
}