core: vector_to_list: Create less garbage.
* src/vector.c (vector_to_list): Create less garbage.
This commit is contained in:
parent
3330948a90
commit
62a369e6de
|
@ -23,7 +23,8 @@ make_vector__ (int k)
|
|||
{
|
||||
SCM v = alloc (k);
|
||||
SCM x = make_cell__ (TVECTOR, k, v);
|
||||
for (int i=0; i<k; i++) g_cells[v+i] = g_cells[vector_entry (cell_unspecified)];
|
||||
for (int i=0; i<k; i++)
|
||||
g_cells[v+i] = g_cells[vector_entry (cell_unspecified)];
|
||||
return x;
|
||||
}
|
||||
|
||||
|
@ -90,12 +91,12 @@ SCM
|
|||
vector_to_list (SCM v)
|
||||
{
|
||||
SCM x = cell_nil;
|
||||
for (int i = 0; i < LENGTH (v); i++)
|
||||
for (int i = LENGTH (v); i; i--)
|
||||
{
|
||||
SCM e = VECTOR (v)+i;
|
||||
SCM e = VECTOR (v)+i-1;
|
||||
if (TYPE (e) == TREF)
|
||||
e = REF (e);
|
||||
x = append2 (x, cons (e, cell_nil));
|
||||
x = cons (e, x);
|
||||
}
|
||||
return x;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue