mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-20 11:40:18 +02:00
Added scm_gc_malloc_pointerless ()', equivalent to
GC_MALLOC_ATOMIC ()'.
* libguile/gc-malloc.c (scm_gc_register_collectable_memory): Tidied. (scm_gc_unregister_collectable_memory): Likewise. (scm_gc_malloc_pointerless): New. * libguile/gc.h (scm_gc_malloc_pointer_less): New declaration. * libguile/strings.c (make_stringbuf): Use it. git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-5
This commit is contained in:
parent
6a4be32986
commit
c5018a2bbb
3 changed files with 12 additions and 3 deletions
|
@ -169,23 +169,32 @@ scm_strdup (const char *str)
|
|||
void
|
||||
scm_gc_register_collectable_memory (void *mem, size_t size, const char *what)
|
||||
{
|
||||
/* Nothing to do. */
|
||||
#ifdef GUILE_DEBUG_MALLOC
|
||||
if (mem)
|
||||
scm_malloc_register (mem);
|
||||
#endif
|
||||
fprintf (stderr, "%s: nothing done\n", __FUNCTION__); /* FIXME: What to do? */
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
scm_gc_unregister_collectable_memory (void *mem, size_t size, const char *what)
|
||||
{
|
||||
/* Nothing to do. */
|
||||
#ifdef GUILE_DEBUG_MALLOC
|
||||
if (mem)
|
||||
scm_malloc_unregister (mem);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Allocate SIZE bytes of memory whose contents should not be scanned for
|
||||
pointers (useful, e.g., for strings). */
|
||||
void *
|
||||
scm_gc_malloc_pointerless (size_t size, const char *what)
|
||||
{
|
||||
return GC_MALLOC_ATOMIC (size);
|
||||
}
|
||||
|
||||
void *
|
||||
scm_gc_malloc (size_t size, const char *what)
|
||||
{
|
||||
|
|
|
@ -229,6 +229,7 @@ SCM_API void scm_gc_register_collectable_memory (void *mem, size_t size,
|
|||
const char *what);
|
||||
SCM_API void scm_gc_unregister_collectable_memory (void *mem, size_t size,
|
||||
const char *what);
|
||||
SCM_API void *scm_gc_malloc_pointerless (size_t size, const char *what);
|
||||
SCM_API void *scm_gc_calloc (size_t size, const char *what);
|
||||
SCM_API void *scm_gc_malloc (size_t size, const char *what);
|
||||
SCM_API void *scm_gc_realloc (void *mem, size_t old_size,
|
||||
|
|
|
@ -115,8 +115,7 @@ make_stringbuf (size_t len)
|
|||
}
|
||||
else
|
||||
{
|
||||
/* FIXME: Create an `scm_gc' equivalent to `GC_MALLOC_ATOMIC ()'. */
|
||||
char *mem = GC_MALLOC_ATOMIC (len + 1);/* scm_gc_malloc (len+1, "string"); */
|
||||
char *mem = scm_gc_malloc_pointerless (len + 1, "string");
|
||||
mem[len] = '\0';
|
||||
return scm_double_cell (STRINGBUF_TAG, (scm_t_bits) mem,
|
||||
(scm_t_bits) len, (scm_t_bits) 0);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue