core: make_struct: Nicer gc layout.

* src/struct.c (make_struct): Use STRUCT TYPE PRINTER FIELD0 ... FIELDN.
This commit is contained in:
Jan Nieuwenhuizen 2019-10-27 16:03:31 +01:00
parent 63b1e7e10e
commit 4118393e6f
No known key found for this signature in database
GPG Key ID: F3C1A0D9C1D65273
1 changed files with 4 additions and 1 deletions

View File

@ -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;