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:
parent
c2cc896cb4
commit
5513bbbdb2
|
|
@ -12,6 +12,8 @@ Author: 1987 Kanwar Jit Singh
|
||||||
int
|
int
|
||||||
ASRCdelete(GENinstance *gen_inst)
|
ASRCdelete(GENinstance *gen_inst)
|
||||||
{
|
{
|
||||||
NG_IGNORE(gen_inst);
|
ASRCinstance *inst = (ASRCinstance *) gen_inst;
|
||||||
|
|
||||||
|
FREE(inst->ASRCacValues);
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -32,14 +32,17 @@ ASRCmDelete(GENmodel **modList, IFuid modname, GENmodel *killModel)
|
||||||
*oldmod = (*model)->ASRCnextModel; /* cut deleted device out of list */
|
*oldmod = (*model)->ASRCnextModel; /* cut deleted device out of list */
|
||||||
|
|
||||||
for (here = (*model)->ASRCinstances; here; here = here->ASRCnextInstance) {
|
for (here = (*model)->ASRCinstances; here; here = here->ASRCnextInstance) {
|
||||||
FREE(here->ASRCacValues);
|
if (prev) {
|
||||||
if (prev)
|
ASRCdelete((GENinstance *) prev);
|
||||||
FREE(prev);
|
FREE(prev);
|
||||||
|
}
|
||||||
prev = here;
|
prev = here;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (prev)
|
if (prev) {
|
||||||
|
ASRCdelete((GENinstance *) prev);
|
||||||
FREE(prev);
|
FREE(prev);
|
||||||
|
}
|
||||||
FREE(*model);
|
FREE(*model);
|
||||||
return(OK);
|
return(OK);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue