core: make_struct: Avoid creating garbage.
* src/struct.c (make_struct): Use STRUCT TYPE PRINTER FIELD0 ... FIELDN.
This commit is contained in:
parent
b30af2ce9f
commit
c247733bcd
|
@ -25,8 +25,11 @@ SCM
|
|||
make_struct (SCM type, SCM fields, SCM printer)
|
||||
{
|
||||
long size = 2 + length__ (fields);
|
||||
SCM x = alloc (1);
|
||||
SCM v = alloc (size);
|
||||
SCM x = make_cell (TSTRUCT, size, v);
|
||||
TYPE (x) = TSTRUCT;
|
||||
LENGTH (x) = size;
|
||||
STRUCT (x) = v;
|
||||
copy_cell (v, vector_entry (type));
|
||||
copy_cell (cell_ref (v, 1), vector_entry (printer));
|
||||
long i;
|
||||
|
|
Loading…
Reference in a new issue