mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-07-02 23:50:47 +02:00
Convert scm_gc_malloc* calls to scm_allocate*
* libguile/arrays.c: * libguile/bitvectors.c: * libguile/bytevectors.c: * libguile/chooks.c: * libguile/continuations.c: * libguile/control.c: * libguile/dynstack.c: * libguile/ephemerons.c: * libguile/filesys.c: * libguile/foreign.c: * libguile/fports.c: * libguile/frames.c: * libguile/gsubr.c: * libguile/hashtab.c: * libguile/i18n.c: * libguile/integers.c: * libguile/intrinsics.c: * libguile/load.c: * libguile/loader.c: * libguile/macros.c: * libguile/numbers.c: * libguile/options.c: * libguile/ports.c: * libguile/programs.h: * libguile/random.c: * libguile/read.c: * libguile/regex-posix.c: * libguile/smob.c: * libguile/srfi-14.c: * libguile/strings.c: * libguile/struct.c: * libguile/threads.c: * libguile/threads.h: * libguile/values.c: * libguile/vm.c: Convert all calls to scm_gc_malloc_pointerless to scm_allocate_pointerless. Convert scm_gc_malloc to either scm_allocate_tagged or scm_allocate_sloppy, depending on whether the value can be precisely traced or not.
This commit is contained in:
parent
290a57b1b0
commit
f2ad6525e6
35 changed files with 126 additions and 102 deletions
|
@ -56,6 +56,7 @@
|
|||
#include "srfi-4.h"
|
||||
#include "strings.h"
|
||||
#include "symbols.h"
|
||||
#include "threads.h"
|
||||
#include "uniform.h"
|
||||
#include "version.h"
|
||||
|
||||
|
@ -232,8 +233,8 @@ make_bytevector (size_t len, scm_t_array_element_type element_type)
|
|||
|
||||
size_t c_len = len * bytes_per_elt;
|
||||
struct scm_bytevector *bv =
|
||||
scm_gc_malloc_pointerless (sizeof (struct scm_bytevector) + c_len,
|
||||
"bytevector");
|
||||
scm_allocate_pointerless (SCM_I_CURRENT_THREAD,
|
||||
sizeof (struct scm_bytevector) + c_len);
|
||||
|
||||
scm_t_bits flags = SCM_F_BYTEVECTOR_CONTIGUOUS;
|
||||
bv->tag_flags_and_element_type = make_bytevector_tag (flags, element_type);
|
||||
|
@ -258,7 +259,8 @@ make_bytevector_from_buffer (size_t len, void *contents,
|
|||
size_t bytes_per_elt = scm_i_array_element_type_sizes[element_type]/8;
|
||||
size_t c_len = len * bytes_per_elt;
|
||||
struct scm_bytevector *bv =
|
||||
scm_gc_malloc (sizeof (struct scm_bytevector), "bytevector");
|
||||
scm_allocate_tagged (SCM_I_CURRENT_THREAD,
|
||||
sizeof (struct scm_bytevector));
|
||||
|
||||
scm_t_bits flags = is_immutable ? SCM_F_BYTEVECTOR_IMMUTABLE : 0;
|
||||
bv->tag_flags_and_element_type = make_bytevector_tag (flags, element_type);
|
||||
|
@ -286,11 +288,12 @@ scm_i_make_typed_bytevector (size_t len, scm_t_array_element_type element_type)
|
|||
|
||||
/* Return a bytevector of size LEN made up of CONTENTS. The area
|
||||
pointed to by CONTENTS must be protected from GC somehow: either
|
||||
because it was allocated using `scm_gc_malloc ()', or because it is
|
||||
part of PARENT. */
|
||||
because it is itself GC-managed, or because it is part of PARENT. */
|
||||
SCM
|
||||
scm_c_take_gc_bytevector (signed char *contents, size_t len, SCM parent)
|
||||
{
|
||||
/* FIXME: If contents is an interior pointer to a GC-managed object,
|
||||
we should gc_pin_object() on that parent object! */
|
||||
return scm_from_bytevector
|
||||
(make_bytevector_from_buffer (len, contents, SCM_ARRAY_ELEMENT_TYPE_VU8,
|
||||
parent, 0));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue