summaryrefslogtreecommitdiff
path: root/libguile/gc-malloc.c
diff options
context:
space:
mode:
authorHan-Wen Nienhuys <hanwen@lilypond.org>2002-08-28 23:13:30 +0000
committerHan-Wen Nienhuys <hanwen@lilypond.org>2002-08-28 23:13:30 +0000
commit1383773ba1e50b1c13bc4f4f3d5f0b69de07b5dd (patch)
tree4cce72c07b8e972b25e99793abbacb3877a64989 /libguile/gc-malloc.c
parent8fa5786d7c10e8ee657aad8bf24ec5f229c5258e (diff)
downloadguile-1383773ba1e50b1c13bc4f4f3d5f0b69de07b5dd.tar.gz
* gc.h: remove DOUBLECELL card flags.
* gc-malloc.c (scm_calloc): try to use calloc() before calling scm_realloc(). * gc-segment.c (scm_i_initialize_heap_segment_data): remove card init loop; handle this from scm_init_card_freelist() * gc-card.c (scm_init_card_freelist): init bit vector here.
Diffstat (limited to 'libguile/gc-malloc.c')
-rw-r--r--libguile/gc-malloc.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/libguile/gc-malloc.c b/libguile/gc-malloc.c
index 0cd6bfaad..1dbb448f1 100644
--- a/libguile/gc-malloc.c
+++ b/libguile/gc-malloc.c
@@ -150,7 +150,17 @@ scm_malloc (size_t sz)
void *
scm_calloc (size_t sz)
{
- void * ptr = scm_realloc (NULL, sz);
+ void * ptr;
+
+ /*
+ By default, try to use calloc, as it is likely more efficient than
+ calling memset by hand.
+ */
+ SCM_SYSCALL(ptr= calloc (sz, 1));
+ if (ptr)
+ return ptr;
+
+ ptr = scm_realloc (NULL, sz);
memset (ptr, 0x0, sz);
return ptr;
}