1#include <string.h>2#include <stdlib.h>34#undef strdup56char *7strdup(const char *s)8{9 char *newstr;10 size_t len = strlen(s);1112 if ((newstr = malloc(len + 1)) == NULL)13 return NULL;14 return memcpy(newstr, s, len + 1);15}
A fork of https://git.simple-cc.org/scc/ for Qute
git clone https://git.8pit.net/scc.git
1#include <string.h>2#include <stdlib.h>34#undef strdup56char *7strdup(const char *s)8{9 char *newstr;10 size_t len = strlen(s);1112 if ((newstr = malloc(len + 1)) == NULL)13 return NULL;14 return memcpy(newstr, s, len + 1);15}