DEVmodDelete(), extend ASRCdelete() and use it in ASRCmDelete()

rip instance specific cleanup business from the ASRCmDelete() function.
move this to ASRCdelete()
This commit is contained in:
rlar 2018-02-11 18:15:45 +01:00
parent c3ed42f486
commit 50e9a8c3b6
2 changed files with 9 additions and 4 deletions

View File

@ -12,6 +12,8 @@ Author: 1987 Kanwar Jit Singh
int
ASRCdelete(GENinstance *gen_inst)
{
NG_IGNORE(gen_inst);
ASRCinstance *inst = (ASRCinstance *) gen_inst;
FREE(inst->ASRCacValues);
return OK;
}

View File

@ -32,14 +32,17 @@ ASRCmDelete(GENmodel **modList, IFuid modname, GENmodel *killModel)
*oldmod = (*model)->ASRCnextModel; /* cut deleted device out of list */
for (here = (*model)->ASRCinstances; here; here = here->ASRCnextInstance) {
FREE(here->ASRCacValues);
if (prev)
if (prev) {
ASRCdelete((GENinstance *) prev);
FREE(prev);
}
prev = here;
}
if (prev)
if (prev) {
ASRCdelete((GENinstance *) prev);
FREE(prev);
}
FREE(*model);
return(OK);
}