From bb118b7356439a930be13962ced5f36aab9f74bf Mon Sep 17 00:00:00 2001 From: Fumitoshi UKAI Date: Wed, 10 Jul 2002 14:21:11 +0000 Subject: import gc6.1alpha5 --- gc/malloc.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'gc/malloc.c') diff --git a/gc/malloc.c b/gc/malloc.c index 943f27d..e2db9b4 100644 --- a/gc/malloc.c +++ b/gc/malloc.c @@ -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(); @@ -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. */ -- cgit v1.2.3