introduce GENinstanceFree() and GENmodelFree()
To abstract away the business of releasing the memory of a struct GENmodel or struct GENinstance.
This commit is contained in:
parent
8c7d7051ae
commit
41c0ee45a2
|
|
@ -898,7 +898,7 @@ if_setparam_model(CKTcircuit *ckt, char **name, char *val)
|
|||
INPgetMod(ckt, mods->GENmodName, &inpmod, ft_curckt->ci_symtab);
|
||||
if (curMod != nghash_delete(ckt->MODnameHash, curMod->GENmodName))
|
||||
fprintf(stderr, "ERROR, ouch nasal daemons ...\n");
|
||||
FREE(mods);
|
||||
GENmodelFree(mods);
|
||||
|
||||
inpmod->INPmodfast = NULL;
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -46,4 +46,9 @@ struct GENmodel { /* model structure for a resistor */
|
|||
IFuid GENmodName; /* pointer to character string naming this model */
|
||||
};
|
||||
|
||||
|
||||
void GENinstanceFree(GENinstance *);
|
||||
void GENmodelFree(GENmodel *);
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -47,12 +47,12 @@ CKTdestroy(CKTcircuit *ckt)
|
|||
GENinstance *next_inst = inst->GENnextInstance;
|
||||
if (DEVices[i]->DEVdelete)
|
||||
DEVices[i]->DEVdelete(inst);
|
||||
FREE(inst);
|
||||
GENinstanceFree(inst);
|
||||
inst = next_inst;
|
||||
}
|
||||
if (DEVices[i]->DEVmodDelete)
|
||||
DEVices[i]->DEVmodDelete(model);
|
||||
FREE(model);
|
||||
GENmodelFree(model);
|
||||
model = next_model;
|
||||
}
|
||||
if (DEVices[i]->DEVdestroy)
|
||||
|
|
|
|||
|
|
@ -37,11 +37,11 @@ CKTdltMod(CKTcircuit *ckt, GENmodel *m)
|
|||
fprintf(stderr, "ERROR, ouch nasal daemons ...\n");
|
||||
error = SPfrontEnd->IFdelUid (ckt, h->GENname,
|
||||
UID_INSTANCE);
|
||||
tfree(h);
|
||||
GENinstanceFree(h);
|
||||
}
|
||||
if (m != nghash_delete(ckt->MODnameHash, m->GENmodName))
|
||||
fprintf(stderr, "ERROR, ouch nasal daemons ...\n");
|
||||
error = SPfrontEnd->IFdelUid (ckt, m->GENmodName, UID_MODEL);
|
||||
tfree(m);
|
||||
GENmodelFree(m);
|
||||
return(OK);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,3 +42,17 @@ CKTmodCrt(CKTcircuit *ckt, int type, GENmodel **modfast, IFuid name)
|
|||
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
GENinstanceFree(GENinstance *inst)
|
||||
{
|
||||
txfree(inst);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
GENmodelFree(GENmodel *model)
|
||||
{
|
||||
txfree(model);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue