// Copyright 2022 Darwin Schuppan // SPDX license identifier: MIT #include #include char *strdup(const char *s) { size_t len = strlen(s); char *res = malloc(len + 1); if(res == NULL) return NULL; memcpy(res, s, len+1); return res; }