1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-30 03:40:34 +02:00

Move scm_gc_malloc_pointerless to use Whippet API

* libguile/gc-malloc.c: Trim set of includes.
(do_gc_malloc_atomic): Remove.
(scm_gc_malloc_pointerless): Call scm_inline_gc_malloc_pointerless.
(scm_gc_strndup): Call scm_gc_malloc_pointerless.
This commit is contained in:
Andy Wingo 2025-04-23 15:33:52 +02:00
parent bb4e9a289c
commit e0c5adf52c

View file

@ -23,27 +23,12 @@
# include <config.h>
#endif
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include "arrays.h"
#include "async.h"
#ifdef GUILE_DEBUG_MALLOC
#include "debug-malloc.h"
#endif
#include "deprecation.h"
#include "eval.h"
#include "hashtab.h"
#include "ports.h"
#include "smob.h"
#include "stackchk.h"
#include "stime.h"
#include "strings.h"
#include "struct.h"
#include "vectors.h"
#include "gc-inline.h"
#include "threads.h"
#include "gc.h"
@ -86,12 +71,6 @@ do_gc_malloc (size_t size, const char *what)
return GC_MALLOC (size ? size : sizeof (void *));
}
static void*
do_gc_malloc_atomic (size_t size, const char *what)
{
return GC_MALLOC_ATOMIC (size ? size : sizeof (void *));
}
static void*
do_gc_realloc (void *from, size_t size, const char *what)
{
@ -201,7 +180,8 @@ scm_gc_unregister_collectable_memory (void *mem, size_t size, const char *what)
void *
scm_gc_malloc_pointerless (size_t size, const char *what)
{
return do_gc_malloc_atomic (size, what);
return scm_inline_gc_malloc_pointerless (SCM_I_CURRENT_THREAD,
size ? size : 1);
}
void *
@ -226,7 +206,7 @@ scm_gc_realloc (void *mem, size_t old_size, size_t new_size, const char *what)
char *
scm_gc_strndup (const char *str, size_t n, const char *what)
{
char *dst = do_gc_malloc_atomic (n + 1, what);
char *dst = scm_gc_malloc_pointerless (n + 1, what);
memcpy (dst, str, n);
dst[n] = 0;
return dst;