summaryrefslogtreecommitdiff
path: root/malloc.c
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2011-07-26 17:07:21 +0400
committerIvan Maidanski <ivmai@mail.ru>2011-07-26 17:07:21 +0400
commit3313dcc53de4d5d5f76f58a856beb06688d1f8c7 (patch)
tree112d67f2a8b062a9e238469308394e762e26e2f5 /malloc.c
parent9f27ae7aee7a12b3c99d0ce7dc4c7384e3189fa2 (diff)
downloadbdwgc-3313dcc53de4d5d5f76f58a856beb06688d1f8c7.tar.gz
gc6.1alpha4 tarball importgc6_1alpha4
Diffstat (limited to 'malloc.c')
-rw-r--r--malloc.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/malloc.c b/malloc.c
index 0bbb96ab..5ac21421 100644
--- a/malloc.c
+++ b/malloc.c
@@ -315,7 +315,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 +324,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 +337,20 @@ DCL_LOCK_STATE;
{
return((GC_PTR)REDIRECT_MALLOC(n*lb));
}
+
+# include <string.h>
+# ifdef __STDC__
+ char *strdup(const char *s)
+# else
+ char *strdup(s)
+ char *s;
+# endif
+ {
+ size_t len = strlen + 1;
+ char * result = ((char *)REDIRECT_MALLOC(len+1));
+ BCOPY(s, result, len+1);
+ return result;
+ }
# endif /* REDIRECT_MALLOC */
/* Explicitly deallocate an object p. */
@@ -360,7 +374,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 */