Merge branch 'rs/calloc-array'
[git.git] / compat / strdup.c
blobf3fb978eb3ccfd37baf723d8db3346bcc3e4c4b0
1 #include "../git-compat-util.h"
3 char *gitstrdup(const char *s1)
5 size_t len = strlen(s1) + 1;
6 char *s2 = malloc(len);
8 if (s2)
9 memcpy(s2, s1, len);
10 return s2;