# error "One of STACK_GROWS_UP and STACK_GROWS_DOWN should be defd."
#endif
-#if defined(REDIRECT_MALLOC) && defined(THREADS) && !defined(LINUX)
+#if defined(REDIRECT_MALLOC) && defined(THREADS) && !defined(LINUX) \
+ && !defined(REDIRECT_MALLOC_IN_HEADER)
# error "REDIRECT_MALLOC with THREADS works at most on Linux."
#endif
/* but it is admittedly quite ugly. */
# define GC_debug_malloc_replacement(lb) GC_debug_malloc(lb, GC_DBG_EXTRAS)
+#if !defined(REDIRECT_MALLOC_IN_HEADER)
void * malloc(size_t lb)
{
/* It might help to manually inline the GC_malloc call here. */
}
#endif /* !strndup */
+#endif /* !REDIRECT_MALLOC_IN_HEADER */
+
#undef GC_debug_malloc_replacement
#endif /* REDIRECT_MALLOC */
# define REDIRECT_FREE GC_free
#endif
-#ifdef REDIRECT_FREE
+#if defined(REDIRECT_FREE) && !defined(REDIRECT_MALLOC_IN_HEADER)
void free(void * p)
{
# if defined(GC_LINUX_THREADS) && !defined(USE_PROC_FOR_LIBRARIES)
# define GC_debug_realloc_replacement(p, lb) \
GC_debug_realloc(p, lb, GC_DBG_EXTRAS)
-void * realloc(void * p, size_t lb)
- {
- return(REDIRECT_REALLOC(p, lb));
- }
+# if !defined(REDIRECT_MALLOC_IN_HEADER)
+ void * realloc(void * p, size_t lb)
+ {
+ return(REDIRECT_REALLOC(p, lb));
+ }
+# endif
# undef GC_debug_realloc_replacement
# endif /* REDIRECT_REALLOC */