mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-04-29 19:30:36 +02:00
Use scm_inline_gc_malloc for scm_gc_malloc
* libguile/gc-malloc.c (do_realloc, do_calloc): Remove. (scm_gc_malloc): Dispatch to scm_inline_gc_malloc. (scm_gc_calloc): Dispatch to scm_gc_malloc. (scm_gc_realloc): Mark for removal. The issue is that the realloc'd object should have the same kind. We could add Whippet API but it would be nice to not do that.
This commit is contained in:
parent
1b6055dbbd
commit
4ccd57aca8
1 changed files with 5 additions and 18 deletions
|
@ -63,20 +63,6 @@ do_calloc (size_t n, size_t size)
|
|||
return calloc (n, size);
|
||||
}
|
||||
|
||||
static void*
|
||||
do_gc_malloc (size_t size, const char *what)
|
||||
{
|
||||
/* Ensure nonzero size to be compatible with always-nonzero return of
|
||||
glibc malloc. */
|
||||
return GC_MALLOC (size ? size : sizeof (void *));
|
||||
}
|
||||
|
||||
static void*
|
||||
do_gc_realloc (void *from, size_t size, const char *what)
|
||||
{
|
||||
return GC_REALLOC (from, size ? size : sizeof (void *));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Function for non-cell memory management.
|
||||
|
@ -187,20 +173,21 @@ scm_gc_malloc_pointerless (size_t size, const char *what)
|
|||
void *
|
||||
scm_gc_malloc (size_t size, const char *what)
|
||||
{
|
||||
return do_gc_malloc (size, what);
|
||||
return scm_inline_gc_malloc (SCM_I_CURRENT_THREAD, size ? size : 1);
|
||||
}
|
||||
|
||||
void *
|
||||
scm_gc_calloc (size_t size, const char *what)
|
||||
{
|
||||
/* `GC_MALLOC ()' always returns a zeroed buffer. */
|
||||
return do_gc_malloc (size, what);
|
||||
/* `scm_gc_malloc ()' always returns a zeroed buffer. */
|
||||
return scm_gc_malloc (size, what);
|
||||
}
|
||||
|
||||
void *
|
||||
scm_gc_realloc (void *mem, size_t old_size, size_t new_size, const char *what)
|
||||
{
|
||||
return do_gc_realloc (mem, new_size, what);
|
||||
/* FIXME: Remove me. */
|
||||
return GC_REALLOC (mem, new_size ? new_size : sizeof (void *));
|
||||
}
|
||||
|
||||
char *
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue