=================================================================== RCS file: /home/cvs/OpenXM_contrib2/asir2000/gc/malloc.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -p -r1.4 -r1.5 --- OpenXM_contrib2/asir2000/gc/malloc.c 2002/07/24 07:46:19 1.4 +++ OpenXM_contrib2/asir2000/gc/malloc.c 2002/07/24 08:00:10 1.5 @@ -182,6 +182,7 @@ register int k; ptr_t result; DCL_LOCK_STATE; + if (GC_debugging_started) GC_print_all_smashed(); GC_INVOKE_FINALIZERS(); if (SMALL_OBJ(lb)) { DISABLE_SIGNALS(); @@ -315,7 +316,7 @@ DCL_LOCK_STATE; /* It might help to manually inline the GC_malloc call here. */ /* But any decent compiler should reduce the extra procedure call */ /* to at most a jump instruction in this case. */ -# if defined(I386) && defined(SOLARIS_THREADS) +# if defined(I386) && defined(GC_SOLARIS_THREADS) /* * Thread initialisation can call malloc before * we're ready for it. @@ -324,7 +325,7 @@ DCL_LOCK_STATE; * inopportune times. */ if (!GC_is_initialized) return sbrk(lb); -# endif /* I386 && SOLARIS_THREADS */ +# endif /* I386 && GC_SOLARIS_THREADS */ return((GC_PTR)REDIRECT_MALLOC(lb)); } @@ -337,6 +338,26 @@ DCL_LOCK_STATE; { return((GC_PTR)REDIRECT_MALLOC(n*lb)); } + +#ifndef strdup +# include +# ifdef __STDC__ + char *strdup(const char *s) +# else + char *strdup(s) + char *s; +# endif + { + size_t len = strlen(s) + 1; + char * result = ((char *)REDIRECT_MALLOC(len+1)); + BCOPY(s, result, len+1); + return result; + } +#endif /* !defined(strdup) */ + /* If strdup is macro defined, we assume that it actually calls malloc, */ + /* and thus the right thing will happen even without overriding it. */ + /* This seems to be true on most Linux systems. */ + # endif /* REDIRECT_MALLOC */ /* Explicitly deallocate an object p. */ @@ -360,7 +381,7 @@ DCL_LOCK_STATE; h = HBLKPTR(p); hhdr = HDR(h); # if defined(REDIRECT_MALLOC) && \ - (defined(SOLARIS_THREADS) || defined(LINUX_THREADS) \ + (defined(GC_SOLARIS_THREADS) || defined(GC_LINUX_THREADS) \ || defined(__MINGW32__)) /* Should this be MSWIN32 in general? */ /* For Solaris, we have to redirect malloc calls during */ /* initialization. For the others, this seems to happen */