diff options
| author | Junio C Hamano <gitster@pobox.com> | 2016-09-12 15:34:36 -0700 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2016-09-12 15:34:36 -0700 |
| commit | 27853a85edce65afd73c8bb0ca7adf0a4468def3 (patch) | |
| tree | c2afb3b465f0d1ed53089e137960ee8ad82e3a7a /compat/strdup.c | |
| parent | d1de693d0d83b2d0d12320312ae523c7711bf627 (diff) | |
| parent | ca2baa3f7532dfe1816b623f39489ed10f3c9a49 (diff) | |
Merge branch 'rs/compat-strdup'
* rs/compat-strdup:
compat: move strdup(3) replacement to its own file
Diffstat (limited to 'compat/strdup.c')
| -rw-r--r-- | compat/strdup.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/compat/strdup.c b/compat/strdup.c new file mode 100644 index 0000000000..f3fb978eb3 --- /dev/null +++ b/compat/strdup.c @@ -0,0 +1,11 @@ +#include "../git-compat-util.h" + +char *gitstrdup(const char *s1) +{ + size_t len = strlen(s1) + 1; + char *s2 = malloc(len); + + if (s2) + memcpy(s2, s1, len); + return s2; +} |
