summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2016-09-19 13:51:42 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2016-09-19 13:51:42 -0700
commit815a73f7143214510fae6e8a2f2077b2e8694509 (patch)
tree1485e912318ae3f088a54190d448babb52b925c4 /Makefile
parentMerge branch 'jk/squelch-false-warning-from-gcc-o3' into maint (diff)
parentcompat: move strdup(3) replacement to its own file (diff)
downloadtgif-815a73f7143214510fae6e8a2f2077b2e8694509.tar.xz
Merge branch 'rs/compat-strdup' into maint
Code cleanup. * rs/compat-strdup: compat: move strdup(3) replacement to its own file
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile17
1 files changed, 14 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index d96ecb7141..7f184923dd 100644
--- a/Makefile
+++ b/Makefile
@@ -296,6 +296,11 @@ all::
# Define USE_NED_ALLOCATOR if you want to replace the platforms default
# memory allocators with the nedmalloc allocator written by Niall Douglas.
#
+# Define OVERRIDE_STRDUP to override the libc version of strdup(3).
+# This is necessary when using a custom allocator in order to avoid
+# crashes due to allocation and free working on different 'heaps'.
+# It's defined automatically if USE_NED_ALLOCATOR is set.
+#
# Define NO_REGEX if you have no or inferior regex support in your C library.
#
# Define HAVE_DEV_TTY if your system can open /dev/tty to interact with the
@@ -1456,8 +1461,14 @@ ifdef NATIVE_CRLF
endif
ifdef USE_NED_ALLOCATOR
- COMPAT_CFLAGS += -Icompat/nedmalloc
- COMPAT_OBJS += compat/nedmalloc/nedmalloc.o
+ COMPAT_CFLAGS += -Icompat/nedmalloc
+ COMPAT_OBJS += compat/nedmalloc/nedmalloc.o
+ OVERRIDE_STRDUP = YesPlease
+endif
+
+ifdef OVERRIDE_STRDUP
+ COMPAT_CFLAGS += -DOVERRIDE_STRDUP
+ COMPAT_OBJS += compat/strdup.o
endif
ifdef GIT_TEST_CMP_USE_COPIED_CONTEXT
@@ -2029,7 +2040,7 @@ endif
ifdef USE_NED_ALLOCATOR
compat/nedmalloc/nedmalloc.sp compat/nedmalloc/nedmalloc.o: EXTRA_CPPFLAGS = \
- -DNDEBUG -DOVERRIDE_STRDUP -DREPLACE_SYSTEM_ALLOCATOR
+ -DNDEBUG -DREPLACE_SYSTEM_ALLOCATOR
compat/nedmalloc/nedmalloc.sp: SPARSE_FLAGS += -Wno-non-pointer-null
endif