remove pic_irep.ilen
This commit is contained in:
parent
5e58847721
commit
e96465f724
|
@ -701,8 +701,8 @@ codegen_context_destroy(pic_state *pic, codegen_context *cxt)
|
||||||
irep->localc = (int)cxt->locals->len;
|
irep->localc = (int)cxt->locals->len;
|
||||||
irep->capturec = (int)cxt->captures->len;
|
irep->capturec = (int)cxt->captures->len;
|
||||||
irep->code = pic_realloc(pic, cxt->code, sizeof(pic_code) * cxt->clen);
|
irep->code = pic_realloc(pic, cxt->code, sizeof(pic_code) * cxt->clen);
|
||||||
irep->irep = pic_realloc(pic, cxt->irep, sizeof(struct pic_irep *) * cxt->ilen);
|
irep->irep = pic_realloc(pic, cxt->irep, sizeof(struct pic_irep *) * (cxt->ilen + 1));
|
||||||
irep->ilen = cxt->ilen;
|
irep->irep[cxt->ilen] = NULL;
|
||||||
irep->pool = pic_realloc(pic, cxt->pool, sizeof(pic_value) * cxt->plen);
|
irep->pool = pic_realloc(pic, cxt->pool, sizeof(pic_value) * cxt->plen);
|
||||||
irep->plen = cxt->plen;
|
irep->plen = cxt->plen;
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,6 @@ struct pic_irep {
|
||||||
int argc, localc, capturec;
|
int argc, localc, capturec;
|
||||||
bool varg;
|
bool varg;
|
||||||
struct pic_irep **irep;
|
struct pic_irep **irep;
|
||||||
size_t ilen;
|
|
||||||
pic_value *pool;
|
pic_value *pool;
|
||||||
size_t plen;
|
size_t plen;
|
||||||
};
|
};
|
||||||
|
|
|
@ -13,7 +13,7 @@ pic_irep_incref(pic_state PIC_UNUSED(*pic), struct pic_irep *irep)
|
||||||
void
|
void
|
||||||
pic_irep_decref(pic_state *pic, struct pic_irep *irep)
|
pic_irep_decref(pic_state *pic, struct pic_irep *irep)
|
||||||
{
|
{
|
||||||
size_t i;
|
struct pic_irep **i;
|
||||||
|
|
||||||
if (--irep->refc == 0) {
|
if (--irep->refc == 0) {
|
||||||
pic_free(pic, irep->code);
|
pic_free(pic, irep->code);
|
||||||
|
@ -23,8 +23,9 @@ pic_irep_decref(pic_state *pic, struct pic_irep *irep)
|
||||||
irep->list.prev->next = irep->list.next;
|
irep->list.prev->next = irep->list.next;
|
||||||
irep->list.next->prev = irep->list.prev;
|
irep->list.next->prev = irep->list.prev;
|
||||||
|
|
||||||
for (i = 0; i < irep->ilen; ++i) {
|
i = irep->irep;
|
||||||
pic_irep_decref(pic, irep->irep[i]);
|
while (*i) {
|
||||||
|
pic_irep_decref(pic, *i++);
|
||||||
}
|
}
|
||||||
pic_free(pic, irep->irep);
|
pic_free(pic, irep->irep);
|
||||||
pic_free(pic, irep);
|
pic_free(pic, irep);
|
||||||
|
|
Loading…
Reference in New Issue