Fix dropped GC root in fl_vector_alloc (#48)
This commit is contained in:
parent
2afeb42f92
commit
19cecdac20
10
builtins.c
10
builtins.c
|
@ -284,16 +284,14 @@ static value_t fl_vector_alloc(value_t *args, u_int32_t nargs)
|
|||
i = (fixnum_t)toulong(args[0], "vector.alloc");
|
||||
if (i < 0)
|
||||
lerror(ArgError, "vector.alloc: invalid size");
|
||||
v = alloc_vector((unsigned)i, 0);
|
||||
if (nargs == 2)
|
||||
f = args[1];
|
||||
else
|
||||
f = FL_UNSPECIFIED;
|
||||
v = alloc_vector((unsigned)i, f==FL_UNSPECIFIED);
|
||||
if (f != FL_UNSPECIFIED) {
|
||||
int k;
|
||||
for(k=0; k < i; k++)
|
||||
vector_elt(v,k) = f;
|
||||
}
|
||||
int k;
|
||||
for(k=0; k < i; k++)
|
||||
vector_elt(v,k) = f;
|
||||
return v;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue