Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/compat
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2016-09-13 01:34:36 +0300
committerJunio C Hamano <gitster@pobox.com>2016-09-13 01:34:36 +0300
commit27853a85edce65afd73c8bb0ca7adf0a4468def3 (patch)
treec2afb3b465f0d1ed53089e137960ee8ad82e3a7a /compat
parentd1de693d0d83b2d0d12320312ae523c7711bf627 (diff)
parentca2baa3f7532dfe1816b623f39489ed10f3c9a49 (diff)
Merge branch 'rs/compat-strdup'
* rs/compat-strdup: compat: move strdup(3) replacement to its own file
Diffstat (limited to 'compat')
-rw-r--r--compat/nedmalloc/nedmalloc.c16
-rw-r--r--compat/strdup.c11
2 files changed, 11 insertions, 16 deletions
diff --git a/compat/nedmalloc/nedmalloc.c b/compat/nedmalloc/nedmalloc.c
index 2d4ef59013..1cc31c3502 100644
--- a/compat/nedmalloc/nedmalloc.c
+++ b/compat/nedmalloc/nedmalloc.c
@@ -948,22 +948,6 @@ void **nedpindependent_comalloc(nedpool *p, size_t elems, size_t *sizes, void **
return ret;
}
-#ifdef OVERRIDE_STRDUP
-/*
- * This implementation is purely there to override the libc version, to
- * avoid a crash due to allocation and free on different 'heaps'.
- */
-char *strdup(const char *s1)
-{
- size_t len = strlen(s1) + 1;
- char *s2 = malloc(len);
-
- if (s2)
- memcpy(s2, s1, len);
- return s2;
-}
-#endif
-
#if defined(__cplusplus)
}
#endif
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;
+}