aboutsummaryrefslogtreecommitdiffstats
path: root/gc/malloc.c
diff options
context:
space:
mode:
authorFumitoshi UKAI <ukai@debian.or.jp>2002-07-10 14:21:11 +0000
committerFumitoshi UKAI <ukai@debian.or.jp>2002-07-10 14:21:11 +0000
commitbb118b7356439a930be13962ced5f36aab9f74bf (patch)
tree5a9fad8dd6dc7f236bfc8e6b22c04cad0b837928 /gc/malloc.c
parentdelete old ftp site (diff)
downloadw3m-bb118b7356439a930be13962ced5f36aab9f74bf.tar.gz
w3m-bb118b7356439a930be13962ced5f36aab9f74bf.zip
import gc6.1alpha5
Diffstat (limited to '')
-rw-r--r--gc/malloc.c21
1 files changed, 21 insertions, 0 deletions
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 <string.h>
+# 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. */