From eaa1fb752172868b616162b34fafd035d7f306b9 Mon Sep 17 00:00:00 2001 From: rlar Date: Thu, 4 Jan 2018 19:55:25 +0100 Subject: [PATCH] devices/**/XXXdel.c, fix adms too --- .../devices/adms/admst/ngspiceMODULEdel.c.xml | 38 ++++++++----------- 1 file changed, 16 insertions(+), 22 deletions(-) diff --git a/src/spicelib/devices/adms/admst/ngspiceMODULEdel.c.xml b/src/spicelib/devices/adms/admst/ngspiceMODULEdel.c.xml index 4357baa81..6119aa66d 100644 --- a/src/spicelib/devices/adms/admst/ngspiceMODULEdel.c.xml +++ b/src/spicelib/devices/adms/admst/ngspiceMODULEdel.c.xml @@ -40,35 +40,29 @@ - #include "ngspice/ngspice.h" #include "$(module)defs.h" #include "ngspice/sperror.h" #include "ngspice/suffix.h" -int $(module)delete(GENmodel *inModel, IFuid name, GENinstance **inInst) - +int +$(module)delete(GENmodel *model, IFuid name, GENinstance **kill) { - register $(module)model *model = ($(module)model*)inModel; - register $(module)instance **fast =($(module)instance**)inInst; - - $(module)instance **prev = NULL; - $(module)instance *here; - - for ( ; model ; model = model->$(module)nextModel ) { - prev = &(model->$(module)instances); - for (here = *prev; here ; here = *prev) { - if(here->$(module)name == name || (fast && here==*fast) ) { - *prev = here->$(module)nextInstance; - FREE(here); - return(OK); - } - - } - } - return(E_NODEV); -} + for (; model; model = model->GENnextModel) { + GENinstance **prev = &(model->GENinstances); + GENinstance *here = *prev; + for (; here; here = *prev) { + if (here->GENname == name || (kill && here == *kill)) { + *prev = here->GENnextInstance; + FREE(here); + return OK; + } + prev = &(here->GENnextInstance); + } + } + return E_NODEV; +}