bugfix: no allocation between call of producer and pic_receive
This commit is contained in:
parent
c51be07a9a
commit
130d226d65
10
lib/cont.c
10
lib/cont.c
|
@ -202,17 +202,17 @@ pic_cont_values(pic_state *pic)
|
||||||
static pic_value
|
static pic_value
|
||||||
pic_cont_call_with_values(pic_state *pic)
|
pic_cont_call_with_values(pic_state *pic)
|
||||||
{
|
{
|
||||||
pic_value producer, consumer, *retv;
|
pic_value producer, consumer, retv[256];
|
||||||
int retc;
|
int retc;
|
||||||
|
|
||||||
pic_get_args(pic, "ll", &producer, &consumer);
|
pic_get_args(pic, "ll", &producer, &consumer);
|
||||||
|
|
||||||
pic_call(pic, producer, 0);
|
pic_call(pic, producer, 0);
|
||||||
|
|
||||||
retc = pic_receive(pic, 0, NULL);
|
retc = pic_receive(pic, 256, retv);
|
||||||
retv = pic_alloca(pic, sizeof(pic_value) * retc);
|
if (retc > 256) {
|
||||||
|
pic_error(pic, "call-with-values: too many arguments", 1, pic_int_value(pic, retc));
|
||||||
pic_receive(pic, retc, retv);
|
}
|
||||||
|
|
||||||
return pic_applyk(pic, consumer, retc, retv);
|
return pic_applyk(pic, consumer, retc, retv);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue