diff options
Diffstat (limited to 'libguile/gc-malloc.c')
-rw-r--r-- | libguile/gc-malloc.c | 43 |
1 files changed, 16 insertions, 27 deletions
diff --git a/libguile/gc-malloc.c b/libguile/gc-malloc.c index a1d8f2dc8..2720ed8d8 100644 --- a/libguile/gc-malloc.c +++ b/libguile/gc-malloc.c @@ -113,33 +113,6 @@ scm_gc_init_malloc (void) */ void * -scm_malloc (size_t size) -{ - void *ptr; - - if (size == 0) - return NULL; - - SCM_SYSCALL (ptr = malloc (size)); - if (ptr) - return ptr; - - scm_i_sweep_all_segments ("malloc"); - SCM_SYSCALL (ptr = malloc (size)); - if (ptr) - return ptr; - - scm_igc ("malloc"); - scm_i_sweep_all_segments ("malloc/gc"); - - SCM_SYSCALL (ptr = malloc (size)); - if (ptr) - return ptr; - - scm_memory_error ("malloc"); -} - -void * scm_realloc (void *mem, size_t size) { void *ptr; @@ -164,6 +137,13 @@ scm_realloc (void *mem, size_t size) scm_memory_error ("realloc"); } +void * +scm_malloc (size_t sz) +{ + return scm_realloc (NULL, sz); +} + + char * scm_strndup (const char *str, size_t n) { @@ -269,6 +249,15 @@ scm_gc_malloc (size_t size, const char *what) } void * +scm_gc_calloc (size_t size, const char *what) +{ + void *ptr = scm_gc_malloc (size, what); + memset (ptr, 0x0, size); + return ptr; +} + + +void * scm_gc_realloc (void *mem, size_t old_size, size_t new_size, const char *what) { /* XXX - see scm_gc_malloc. */ |