summaryrefslogtreecommitdiff
path: root/git-compat-util.h
diff options
context:
space:
mode:
authorRené Scharfe <l.s.r@web.de>2016-09-03 15:59:15 (GMT)
committerJunio C Hamano <gitster@pobox.com>2016-09-07 17:41:45 (GMT)
commitca2baa3f7532dfe1816b623f39489ed10f3c9a49 (patch)
tree4422885a6aa8511f04adedfbedc71c8599ad932e /git-compat-util.h
parente0c1ceafc5bece92d35773a75fff59497e1d9bd5 (diff)
downloadgit-ca2baa3f7532dfe1816b623f39489ed10f3c9a49.zip
git-ca2baa3f7532dfe1816b623f39489ed10f3c9a49.tar.gz
git-ca2baa3f7532dfe1816b623f39489ed10f3c9a49.tar.bz2
compat: move strdup(3) replacement to its own file
Move our implementation of strdup(3) out of compat/nedmalloc/ and allow it to be used independently from USE_NED_ALLOCATOR. The original nedmalloc doesn't come with strdup() and doesn't need it. Only _users_ of nedmalloc need it, which was added when we imported it to our compat/ hierarchy. This reduces the difference of our copy of nedmalloc from the original, making it easier to update, and allows for easier testing and reusing of our version of strdup(). Signed-off-by: Rene Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-compat-util.h')
-rw-r--r--git-compat-util.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/git-compat-util.h b/git-compat-util.h
index 49d4029..fd4c814 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -646,6 +646,14 @@ void *gitmemmem(const void *haystack, size_t haystacklen,
const void *needle, size_t needlelen);
#endif
+#ifdef OVERRIDE_STRDUP
+#ifdef strdup
+#undef strdup
+#endif
+#define strdup gitstrdup
+char *gitstrdup(const char *s);
+#endif
+
#ifdef NO_GETPAGESIZE
#define getpagesize() sysconf(_SC_PAGESIZE)
#endif