spicelib/devcies/*dest.c, rewrite DEVdestroy() functions

This commit is contained in:
rlar 2016-07-29 22:22:16 +02:00
parent d9e0ae3504
commit 4d79617cf1
56 changed files with 873 additions and 1201 deletions

View File

@ -10,28 +10,25 @@ Author: 1987 Kanwar Jit Singh
void void
ASRCdestroy(GENmodel **model) ASRCdestroy(GENmodel **inModel)
{ {
ASRCmodel **start = (ASRCmodel**) model; /* starting model */ ASRCmodel *mod = *(ASRCmodel**) inModel;
ASRCinstance *here; /* current instance */
ASRCinstance *next;
ASRCmodel *mod = *start; /* current model */
ASRCmodel *nextmod;
for (; mod ; mod = nextmod) { while (mod) {
for (here = mod->ASRCinstances; here; here = next) { ASRCmodel *next_mod = mod->ASRCnextModel;
next = here->ASRCnextInstance; ASRCinstance *inst = mod->ASRCinstances;
FREE(here->ASRCacValues); while (inst) {
INPfreeTree(here->ASRCtree); ASRCinstance *next_inst = inst->ASRCnextInstance;
if (here->ASRCposptr) INPfreeTree(inst->ASRCtree);
free(here->ASRCposptr); FREE(inst->ASRCacValues);
if (here->ASRCvars) FREE(inst->ASRCposptr);
free(here->ASRCvars); FREE(inst->ASRCvars);
FREE(here); FREE(inst);
inst = next_inst;
} }
nextmod = mod->ASRCnextModel;
FREE(mod); FREE(mod);
mod = next_mod;
} }
*model = NULL; *inModel = NULL;
} }

View File

@ -2,8 +2,6 @@
Copyright 1990 Regents of the University of California. All rights reserved. Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1985 Thomas L. Quarles Author: 1985 Thomas L. Quarles
**********/ **********/
/*
*/
/* /*
* This routine deletes all BJTs from the circuit and frees * This routine deletes all BJTs from the circuit and frees
@ -17,31 +15,21 @@ Author: 1985 Thomas L. Quarles
void void
BJTdestroy(GENmodel **inModel) BJTdestroy(GENmodel **inModel)
{ {
BJTmodel *mod = *(BJTmodel**) inModel;
BJTmodel **model = (BJTmodel**)inModel; while (mod) {
BJTinstance *here; BJTmodel *next_mod = mod->BJTnextModel;
BJTinstance *prev = NULL; BJTinstance *inst = mod->BJTinstances;
BJTmodel *mod = *model; while (inst) {
BJTmodel *oldmod = NULL; BJTinstance *next_inst = inst->BJTnextInstance;
FREE(inst->BJTsens);
for( ; mod ; mod = mod->BJTnextModel) { FREE(inst);
if(oldmod) FREE(oldmod); inst = next_inst;
oldmod = mod;
prev = NULL;
for(here = mod->BJTinstances ; here ; here = here->BJTnextInstance) {
if(prev){
if(prev->BJTsens) FREE(prev->BJTsens);
FREE(prev);
}
prev = here;
}
if(prev){
if(prev->BJTsens) FREE(prev->BJTsens);
FREE(prev);
} }
FREE(mod);
mod = next_mod;
} }
if(oldmod) FREE(oldmod);
*model = NULL; *inModel = NULL;
} }

View File

@ -2,8 +2,6 @@
Copyright 1990 Regents of the University of California. All rights reserved. Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1985 Hong J. Park, Thomas L. Quarles Author: 1985 Hong J. Park, Thomas L. Quarles
**********/ **********/
/*
*/
#include "ngspice/ngspice.h" #include "ngspice/ngspice.h"
#include "bsim1def.h" #include "bsim1def.h"
@ -13,23 +11,19 @@ Author: 1985 Hong J. Park, Thomas L. Quarles
void void
B1destroy(GENmodel **inModel) B1destroy(GENmodel **inModel)
{ {
B1model *mod = *(B1model**) inModel;
B1model **model = (B1model**)inModel; while (mod) {
B1instance *here; B1model *next_mod = mod->B1nextModel;
B1instance *prev = NULL; B1instance *inst = mod->B1instances;
B1model *mod = *model; while (inst) {
B1model *oldmod = NULL; B1instance *next_inst = inst->B1nextInstance;
FREE(inst);
for( ; mod ; mod = mod->B1nextModel) { inst = next_inst;
if(oldmod) FREE(oldmod);
oldmod = mod;
prev = NULL;
for(here = mod->B1instances ; here ; here = here->B1nextInstance) {
if(prev) FREE(prev);
prev = here;
} }
if(prev) FREE(prev); FREE(mod);
mod = next_mod;
} }
if(oldmod) FREE(oldmod);
*model = NULL; *inModel = NULL;
} }

View File

@ -2,8 +2,6 @@
Copyright 1990 Regents of the University of California. All rights reserved. Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1985 Hong J. Park, Thomas L. Quarles Author: 1985 Hong J. Park, Thomas L. Quarles
**********/ **********/
/*
*/
#include "ngspice/ngspice.h" #include "ngspice/ngspice.h"
#include "bsim2def.h" #include "bsim2def.h"
@ -13,24 +11,19 @@ Author: 1985 Hong J. Park, Thomas L. Quarles
void void
B2destroy(GENmodel **inModel) B2destroy(GENmodel **inModel)
{ {
B2model *mod = *(B2model**) inModel;
B2model **model = (B2model**)inModel; while (mod) {
B2instance *here; B2model *next_mod = mod->B2nextModel;
B2instance *prev = NULL; B2instance *inst = mod->B2instances;
B2model *mod = *model; while (inst) {
B2model *oldmod = NULL; B2instance *next_inst = inst->B2nextInstance;
FREE(inst);
for( ; mod ; mod = mod->B2nextModel) { inst = next_inst;
if(oldmod) FREE(oldmod);
oldmod = mod;
prev = NULL;
for(here = mod->B2instances ; here ; here = here->B2nextInstance) {
if(prev) FREE(prev);
prev = here;
} }
if(prev) FREE(prev); FREE(mod);
mod = next_mod;
} }
if(oldmod) FREE(oldmod);
*model = NULL;
}
*inModel = NULL;
}

View File

@ -12,53 +12,41 @@
#include "bsim3def.h" #include "bsim3def.h"
#include "ngspice/suffix.h" #include "ngspice/suffix.h"
void void
BSIM3destroy( BSIM3destroy(GENmodel **inModel)
GENmodel **inModel)
{ {
BSIM3model **model = (BSIM3model**)inModel; BSIM3model *mod = *(BSIM3model**) inModel;
BSIM3instance *here;
BSIM3instance *prev = NULL;
BSIM3model *mod = *model;
BSIM3model *oldmod = NULL;
for (; mod ; mod = mod->BSIM3nextModel) { #ifdef USE_OMP
/** added to get rid of link list pSizeDependParamKnot **/
struct bsim3SizeDependParam *pParam, *pParamOld=NULL;
pParam = mod->pSizeDependParamKnot;
for (; pParam ; pParam = pParam->pNext) {
FREE(pParamOld);
pParamOld = pParam;
}
FREE(pParamOld);
pParam = NULL;
/** end of extra code **/
if(oldmod) {
FREE(oldmod->BSIM3version);
FREE(oldmod);
}
oldmod = mod;
prev = NULL;
for (here = mod->BSIM3instances; here; here = here->BSIM3nextInstance) {
if(prev) FREE(prev);
prev = here;
}
if(prev) FREE(prev);
}
if(oldmod) {
#ifdef USE_OMP
/* free just once for all models */ /* free just once for all models */
FREE(oldmod->BSIM3InstanceArray); FREE(mod->BSIM3InstanceArray);
#endif #endif
/* oldmod->BSIM3modName to be freed in INPtabEnd() */
FREE(oldmod->BSIM3version); while (mod) {
FREE(oldmod); BSIM3model *next_mod = mod->BSIM3nextModel;
BSIM3instance *inst = mod->BSIM3instances;
/** added to get rid of link list pSizeDependParamKnot **/
struct bsim3SizeDependParam *p = mod->pSizeDependParamKnot;
while (p) {
struct bsim3SizeDependParam *next_p = p->pNext;
FREE(p);
p = next_p;
}
/** end of extra code **/
while (inst) {
BSIM3instance *next_inst = inst->BSIM3nextInstance;
FREE(inst);
inst = next_inst;
}
/* mod->BSIM3modName to be freed in INPtabEnd() */
FREE(mod->BSIM3version);
FREE(mod);
mod = next_mod;
} }
*model = NULL;
return; *inModel = NULL;
} }

View File

@ -6,7 +6,7 @@ Modified by Paolo Nenzi 2002
**********/ **********/
/* /*
* Revision 2.1 99/9/27 Pin Su * Revision 2.1 99/9/27 Pin Su
* BSIMDD2.1 release * BSIMDD2.1 release
*/ */
@ -14,29 +14,23 @@ Modified by Paolo Nenzi 2002
#include "b3soidddef.h" #include "b3soidddef.h"
#include "ngspice/suffix.h" #include "ngspice/suffix.h"
void void
B3SOIDDdestroy(GENmodel **inModel) B3SOIDDdestroy(GENmodel **inModel)
{ {
B3SOIDDmodel **model = (B3SOIDDmodel**)inModel; B3SOIDDmodel *mod = *(B3SOIDDmodel**) inModel;
B3SOIDDinstance *here;
B3SOIDDinstance *prev = NULL;
B3SOIDDmodel *mod = *model;
B3SOIDDmodel *oldmod = NULL;
for (; mod ; mod = mod->B3SOIDDnextModel) while (mod) {
{ if(oldmod) FREE(oldmod); B3SOIDDmodel *next_mod = mod->B3SOIDDnextModel;
oldmod = mod; B3SOIDDinstance *inst = mod->B3SOIDDinstances;
prev = NULL; while (inst) {
for (here = mod->B3SOIDDinstances; here; here = here->B3SOIDDnextInstance) B3SOIDDinstance *next_inst = inst->B3SOIDDnextInstance;
{ if(prev) FREE(prev); FREE(inst);
prev = here; inst = next_inst;
} }
if(prev) FREE(prev); FREE(mod);
mod = next_mod;
} }
if(oldmod) FREE(oldmod);
*model = NULL; *inModel = NULL;
return;
} }

View File

@ -6,7 +6,7 @@ File: b3soifddest.c 98/5/01
**********/ **********/
/* /*
* Revision 2.1 99/9/27 Pin Su * Revision 2.1 99/9/27 Pin Su
* BSIMFD2.1 release * BSIMFD2.1 release
*/ */
@ -14,29 +14,23 @@ File: b3soifddest.c 98/5/01
#include "b3soifddef.h" #include "b3soifddef.h"
#include "ngspice/suffix.h" #include "ngspice/suffix.h"
void void
B3SOIFDdestroy(GENmodel **inModel) B3SOIFDdestroy(GENmodel **inModel)
{ {
B3SOIFDmodel **model = (B3SOIFDmodel**)inModel; B3SOIFDmodel *mod = *(B3SOIFDmodel**) inModel;
B3SOIFDinstance *here;
B3SOIFDinstance *prev = NULL;
B3SOIFDmodel *mod = *model;
B3SOIFDmodel *oldmod = NULL;
for (; mod ; mod = mod->B3SOIFDnextModel) while (mod) {
{ if(oldmod) FREE(oldmod); B3SOIFDmodel *next_mod = mod->B3SOIFDnextModel;
oldmod = mod; B3SOIFDinstance *inst = mod->B3SOIFDinstances;
prev = NULL; while (inst) {
for (here = mod->B3SOIFDinstances; here; here = here->B3SOIFDnextInstance) B3SOIFDinstance *next_inst = inst->B3SOIFDnextInstance;
{ if(prev) FREE(prev); FREE(inst);
prev = here; inst = next_inst;
} }
if(prev) FREE(prev); FREE(mod);
mod = next_mod;
} }
if(oldmod) FREE(oldmod);
*model = NULL; *inModel = NULL;
return;
} }

View File

@ -6,7 +6,7 @@ Modified by Paolo Nenzi 2002
**********/ **********/
/* /*
* Revision 2.2.3 02/3/5 Pin Su * Revision 2.2.3 02/3/5 Pin Su
* BSIMPD2.2.3 release * BSIMPD2.2.3 release
*/ */
@ -14,29 +14,23 @@ Modified by Paolo Nenzi 2002
#include "b3soipddef.h" #include "b3soipddef.h"
#include "ngspice/suffix.h" #include "ngspice/suffix.h"
void void
B3SOIPDdestroy(GENmodel **inModel) B3SOIPDdestroy(GENmodel **inModel)
{ {
B3SOIPDmodel **model = (B3SOIPDmodel**)inModel; B3SOIPDmodel *mod = *(B3SOIPDmodel**) inModel;
B3SOIPDinstance *here;
B3SOIPDinstance *prev = NULL;
B3SOIPDmodel *mod = *model;
B3SOIPDmodel *oldmod = NULL;
for (; mod ; mod = mod->B3SOIPDnextModel) while (mod) {
{ if(oldmod) FREE(oldmod); B3SOIPDmodel *next_mod = mod->B3SOIPDnextModel;
oldmod = mod; B3SOIPDinstance *inst = mod->B3SOIPDinstances;
prev = NULL; while (inst) {
for (here = mod->B3SOIPDinstances; here; here = here->B3SOIPDnextInstance) B3SOIPDinstance *next_inst = inst->B3SOIPDnextInstance;
{ if(prev) FREE(prev); FREE(inst);
prev = here; inst = next_inst;
} }
if(prev) FREE(prev); FREE(mod);
mod = next_mod;
} }
if(oldmod) FREE(oldmod);
*model = NULL; *inModel = NULL;
return;
} }

View File

@ -8,29 +8,23 @@ File: b3v0dest.c
#include "bsim3v0def.h" #include "bsim3v0def.h"
#include "ngspice/suffix.h" #include "ngspice/suffix.h"
void void
BSIM3v0destroy(GENmodel **inModel) BSIM3v0destroy(GENmodel **inModel)
{ {
BSIM3v0model **model = (BSIM3v0model**)inModel; BSIM3v0model *mod = *(BSIM3v0model**) inModel;
BSIM3v0instance *here;
BSIM3v0instance *prev = NULL;
BSIM3v0model *mod = *model;
BSIM3v0model *oldmod = NULL;
for (; mod ; mod = mod->BSIM3v0nextModel) while (mod) {
{ if(oldmod) FREE(oldmod); BSIM3v0model *next_mod = mod->BSIM3v0nextModel;
oldmod = mod; BSIM3v0instance *inst = mod->BSIM3v0instances;
prev = NULL; while (inst) {
for (here = mod->BSIM3v0instances; here; here = here->BSIM3v0nextInstance) BSIM3v0instance *next_inst = inst->BSIM3v0nextInstance;
{ if(prev) FREE(prev); FREE(inst);
prev = here; inst = next_inst;
} }
if(prev) FREE(prev); FREE(mod);
mod = next_mod;
} }
if(oldmod) FREE(oldmod);
*model = NULL; *inModel = NULL;
return;
} }

View File

@ -1,12 +1,12 @@
/********** /**********
* Copyright 1990 Regents of the University of California. All rights reserved. * Copyright 1990 Regents of the University of California. All rights reserved.
* File: b3v1dest.c * File: b3v1dest.c
* Author: 1995 Min-Chie Jeng and Mansun Chan. * Author: 1995 Min-Chie Jeng and Mansun Chan.
* Modified by Paolo Nenzi 2002 * Modified by Paolo Nenzi 2002
**********/ **********/
/* /*
* Release Notes: * Release Notes:
* BSIM3v3.1, Released by yuhua 96/12/08 * BSIM3v3.1, Released by yuhua 96/12/08
*/ */
@ -14,29 +14,23 @@
#include "bsim3v1def.h" #include "bsim3v1def.h"
#include "ngspice/suffix.h" #include "ngspice/suffix.h"
void void
BSIM3v1destroy(GENmodel **inModel) BSIM3v1destroy(GENmodel **inModel)
{ {
BSIM3v1model **model = (BSIM3v1model**)inModel; BSIM3v1model *mod = *(BSIM3v1model**) inModel;
BSIM3v1instance *here;
BSIM3v1instance *prev = NULL;
BSIM3v1model *mod = *model;
BSIM3v1model *oldmod = NULL;
for (; mod ; mod = mod->BSIM3v1nextModel) while (mod) {
{ if(oldmod) FREE(oldmod); BSIM3v1model *next_mod = mod->BSIM3v1nextModel;
oldmod = mod; BSIM3v1instance *inst = mod->BSIM3v1instances;
prev = NULL; while (inst) {
for (here = mod->BSIM3v1instances; here; here = here->BSIM3v1nextInstance) BSIM3v1instance *next_inst = inst->BSIM3v1nextInstance;
{ if(prev) FREE(prev); FREE(inst);
prev = here; inst = next_inst;
} }
if(prev) FREE(prev); FREE(mod);
mod = next_mod;
} }
if(oldmod) FREE(oldmod);
*model = NULL; *inModel = NULL;
return;
} }

View File

@ -13,48 +13,37 @@
#include "bsim3v32def.h" #include "bsim3v32def.h"
#include "ngspice/suffix.h" #include "ngspice/suffix.h"
void void
BSIM3v32destroy (GENmodel **inModel) BSIM3v32destroy (GENmodel **inModel)
{ {
BSIM3v32model **model = (BSIM3v32model**)inModel; BSIM3v32model *mod = *(BSIM3v32model**) inModel;
BSIM3v32instance *here;
BSIM3v32instance *prev = NULL;
BSIM3v32model *mod = *model;
BSIM3v32model *oldmod = NULL;
for (; mod ; mod = mod->BSIM3v32nextModel) {
/** added to get rid of link list pSizeDependParamKnot **/
struct bsim3v32SizeDependParam *pParam, *pParamOld=NULL;
pParam = mod->pSizeDependParamKnot;
for (; pParam ; pParam = pParam->pNext) {
FREE(pParamOld);
pParamOld = pParam;
}
FREE(pParamOld);
pParam = NULL;
/** end of extra code **/
if(oldmod) {
FREE(oldmod->BSIM3v32version);
FREE(oldmod);
}
oldmod = mod;
prev = NULL;
for (here = mod->BSIM3v32instances; here; here = here->BSIM3v32nextInstance) {
if(prev) FREE(prev);
prev = here;
}
if(prev) FREE(prev);
}
if(oldmod) {
#ifdef USE_OMP #ifdef USE_OMP
/* free just once for all models */ /* free just once for all models */
FREE(oldmod->BSIM3v32InstanceArray); FREE(mod->BSIM3v32InstanceArray);
#endif #endif
FREE(oldmod->BSIM3v32version);
FREE(oldmod); while (mod) {
BSIM3v32model *next_mod = mod->BSIM3v32nextModel;
BSIM3v32instance *inst = mod->BSIM3v32instances;
/** added to get rid of link list pSizeDependParamKnot **/
struct bsim3v32SizeDependParam *p = mod->pSizeDependParamKnot;
while (p) {
struct bsim3v32SizeDependParam *next_p = p->pNext;
FREE(p);
p = next_p;
}
/** end of extra code **/
while (inst) {
BSIM3v32instance *next_inst = inst->BSIM3v32nextInstance;
FREE(inst);
inst = next_inst;
}
FREE(mod->BSIM3v32version);
FREE(mod);
mod = next_mod;
} }
*model = NULL;
return; *inModel = NULL;
} }

View File

@ -14,50 +14,37 @@
#include "bsim4def.h" #include "bsim4def.h"
#include "ngspice/suffix.h" #include "ngspice/suffix.h"
void void
BSIM4destroy( BSIM4destroy(GENmodel **inModel)
GENmodel **inModel)
{ {
BSIM4model **model = (BSIM4model**)inModel; BSIM4model *mod = *(BSIM4model**) inModel;
BSIM4instance *here;
BSIM4instance *prev = NULL;
BSIM4model *mod = *model;
BSIM4model *oldmod = NULL;
for (; mod ; mod = mod->BSIM4nextModel) {
/** added to get rid of link list pSizeDependParamKnot **/
struct bsim4SizeDependParam *pParam, *pParamOld=NULL;
pParam = mod->pSizeDependParamKnot;
for (; pParam ; pParam = pParam->pNext) {
FREE(pParamOld);
pParamOld = pParam;
}
FREE(pParamOld);
pParam = NULL;
/** end of extra code **/
if(oldmod) {
FREE(oldmod->BSIM4version);
FREE(oldmod);
}
oldmod = mod;
prev = (BSIM4instance *)NULL;
for (here = mod->BSIM4instances; here; here = here->BSIM4nextInstance) {
if(prev) FREE(prev);
prev = here;
}
if(prev) FREE(prev);
}
if(oldmod) {
#ifdef USE_OMP #ifdef USE_OMP
/* free just once for all models */ /* free just once for all models */
FREE(oldmod->BSIM4InstanceArray); FREE(mod->BSIM4InstanceArray);
#endif #endif
/* oldmod->BSIM4modName to be freed in INPtabEnd() */
FREE(oldmod->BSIM4version); while (mod) {
FREE(oldmod); BSIM4model *next_mod = mod->BSIM4nextModel;
BSIM4instance *inst = mod->BSIM4instances;
/** added to get rid of link list pSizeDependParamKnot **/
struct bsim4SizeDependParam *p = mod->pSizeDependParamKnot;
while (p) {
struct bsim4SizeDependParam *next_p = p->pNext;
FREE(p);
p = next_p;
}
/** end of extra code **/
while (inst) {
BSIM4instance *next_inst = inst->BSIM4nextInstance;
FREE(inst);
inst = next_inst;
}
FREE(mod->BSIM4version);
FREE(mod);
mod = next_mod;
} }
*model = NULL;
return; *inModel = NULL;
} }

View File

@ -12,49 +12,37 @@
#include "bsim4v5def.h" #include "bsim4v5def.h"
#include "ngspice/suffix.h" #include "ngspice/suffix.h"
void void
BSIM4v5destroy( BSIM4v5destroy(GENmodel **inModel)
GENmodel **inModel)
{ {
BSIM4v5model **model = (BSIM4v5model**)inModel; BSIM4v5model *mod = *(BSIM4v5model**) inModel;
BSIM4v5instance *here;
BSIM4v5instance *prev = NULL;
BSIM4v5model *mod = *model;
BSIM4v5model *oldmod = NULL;
for (; mod ; mod = mod->BSIM4v5nextModel) {
/** added to get rid of link list pSizeDependParamKnot **/
struct bsim4v5SizeDependParam *pParam, *pParamOld=NULL;
pParam = mod->pSizeDependParamKnot;
for (; pParam ; pParam = pParam->pNext) {
FREE(pParamOld);
pParamOld = pParam;
}
FREE(pParamOld);
pParam = NULL;
/** end of extra code **/
if (oldmod) {
FREE(oldmod->BSIM4v5version);
FREE(oldmod);
}
oldmod = mod;
prev = NULL;
for (here = mod->BSIM4v5instances; here; here = here->BSIM4v5nextInstance) {
if(prev) FREE(prev);
prev = here;
}
if(prev) FREE(prev);
}
if (oldmod) {
#ifdef USE_OMP #ifdef USE_OMP
/* free just once for all models */ /* free just once for all models */
FREE(oldmod->BSIM4v5InstanceArray); FREE(mod->BSIM4v5InstanceArray);
#endif #endif
FREE(oldmod->BSIM4v5version);
FREE(oldmod); while (mod) {
BSIM4v5model *next_mod = mod->BSIM4v5nextModel;
BSIM4v5instance *inst = mod->BSIM4v5instances;
/** added to get rid of link list pSizeDependParamKnot **/
struct bsim4v5SizeDependParam *p = mod->pSizeDependParamKnot;
while (p) {
struct bsim4v5SizeDependParam *next_p = p->pNext;
FREE(p);
p = next_p;
}
/** end of extra code **/
while (inst) {
BSIM4v5instance *next_inst = inst->BSIM4v5nextInstance;
FREE(inst);
inst = next_inst;
}
FREE(mod->BSIM4v5version);
FREE(mod);
mod = next_mod;
} }
*model = NULL;
return; *inModel = NULL;
} }

View File

@ -14,50 +14,37 @@
#include "bsim4v6def.h" #include "bsim4v6def.h"
#include "ngspice/suffix.h" #include "ngspice/suffix.h"
void void
BSIM4v6destroy( BSIM4v6destroy(GENmodel **inModel)
GENmodel **inModel)
{ {
BSIM4v6model **model = (BSIM4v6model**)inModel; BSIM4v6model *mod = *(BSIM4v6model**) inModel;
BSIM4v6instance *here;
BSIM4v6instance *prev = NULL;
BSIM4v6model *mod = *model;
BSIM4v6model *oldmod = NULL;
for (; mod ; mod = mod->BSIM4v6nextModel) {
/** added to get rid of link list pSizeDependParamKnot **/
struct bsim4v6SizeDependParam *pParam, *pParamOld=NULL;
pParam = mod->pSizeDependParamKnot;
for (; pParam ; pParam = pParam->pNext) {
FREE(pParamOld);
pParamOld = pParam;
}
FREE(pParamOld);
pParam = NULL;
/** end of extra code **/
if (oldmod) {
FREE(oldmod->BSIM4v6version);
FREE(oldmod);
}
oldmod = mod;
prev = NULL;
for (here = mod->BSIM4v6instances; here; here = here->BSIM4v6nextInstance) {
if(prev) FREE(prev);
prev = here;
}
if(prev) FREE(prev);
}
if(oldmod) {
#ifdef USE_OMP #ifdef USE_OMP
/* free just once for all models */ /* free just once for all models */
FREE(oldmod->BSIM4v6InstanceArray); FREE(mod->BSIM4v6InstanceArray);
#endif #endif
FREE(oldmod->BSIM4v6version);
FREE(oldmod); while (mod) {
BSIM4v6model *next_mod = mod->BSIM4v6nextModel;
BSIM4v6instance *inst = mod->BSIM4v6instances;
/** added to get rid of link list pSizeDependParamKnot **/
struct bsim4v6SizeDependParam *p = mod->pSizeDependParamKnot;
while (p) {
struct bsim4v6SizeDependParam *next_p = p->pNext;
FREE(p);
p = next_p;
}
/** end of extra code **/
while (inst) {
BSIM4v6instance *next_inst = inst->BSIM4v6nextInstance;
FREE(inst);
inst = next_inst;
}
FREE(mod->BSIM4v6version);
FREE(mod);
mod = next_mod;
} }
*model = NULL;
return; *inModel = NULL;
} }

View File

@ -14,50 +14,38 @@
#include "bsim4v7def.h" #include "bsim4v7def.h"
#include "ngspice/suffix.h" #include "ngspice/suffix.h"
void void
BSIM4v7destroy( BSIM4v7destroy(GENmodel **inModel)
GENmodel **inModel)
{ {
BSIM4v7model **model = (BSIM4v7model**)inModel; BSIM4v7model *mod = *(BSIM4v7model**) inModel;
BSIM4v7instance *here;
BSIM4v7instance *prev = NULL;
BSIM4v7model *mod = *model;
BSIM4v7model *oldmod = NULL;
for (; mod ; mod = mod->BSIM4v7nextModel) {
/** added to get rid of link list pSizeDependParamKnot **/
struct bsim4SizeDependParam *pParam, *pParamOld=NULL;
pParam = mod->pSizeDependParamKnot;
for (; pParam ; pParam = pParam->pNext) {
FREE(pParamOld);
pParamOld = pParam;
}
FREE(pParamOld);
pParam = NULL;
/** end of extra code **/
if(oldmod) {
FREE(oldmod->BSIM4v7version);
FREE(oldmod);
}
oldmod = mod;
prev = (BSIM4v7instance *)NULL;
for (here = mod->BSIM4v7instances; here; here = here->BSIM4v7nextInstance) {
if(prev) FREE(prev);
prev = here;
}
if(prev) FREE(prev);
}
if(oldmod) {
#ifdef USE_OMP #ifdef USE_OMP
/* free just once for all models */ /* free just once for all models */
FREE(oldmod->BSIM4v7InstanceArray); FREE(mod->BSIM4v7InstanceArray);
#endif #endif
/* oldmod->BSIM4v7modName to be freed in INPtabEnd() */
FREE(oldmod->BSIM4v7version); while (mod) {
FREE(oldmod); BSIM4v7model *next_mod = mod->BSIM4v7nextModel;
BSIM4v7instance *inst = mod->BSIM4v7instances;
/** added to get rid of link list pSizeDependParamKnot **/
struct bsim4SizeDependParam *p = mod->pSizeDependParamKnot;
while (p) {
struct bsim4SizeDependParam *next_p = p->pNext;
FREE(p);
p = next_p;
}
/** end of extra code **/
while (inst) {
BSIM4v7instance *next_inst = inst->BSIM4v7nextInstance;
FREE(inst);
inst = next_inst;
}
/* mod->BSIM4v7modName to be freed in INPtabEnd() */
FREE(mod->BSIM4v7version);
FREE(mod);
mod = next_mod;
} }
*model = NULL;
return; *inModel = NULL;
} }

View File

@ -15,35 +15,26 @@
**********/ **********/
#include "ngspice/ngspice.h" #include "ngspice/ngspice.h"
#include "b4soidef.h" #include "b4soidef.h"
#include "ngspice/suffix.h" #include "ngspice/suffix.h"
void void
B4SOIdestroy( B4SOIdestroy(GENmodel **inModel)
GENmodel **inModel)
{ {
B4SOImodel **model = (B4SOImodel**)inModel; B4SOImodel *mod = *(B4SOImodel**) inModel;
B4SOIinstance *here;
B4SOIinstance *prev = NULL;
B4SOImodel *mod = *model;
B4SOImodel *oldmod = NULL;
for (; mod ; mod = mod->B4SOInextModel) while (mod) {
{ if(oldmod) FREE(oldmod); B4SOImodel *next_mod = mod->B4SOInextModel;
oldmod = mod; B4SOIinstance *inst = mod->B4SOIinstances;
prev = (B4SOIinstance *)NULL; while (inst) {
for (here = mod->B4SOIinstances; here; here = here->B4SOInextInstance) B4SOIinstance *next_inst = inst->B4SOInextInstance;
{ FREE(inst);
if(prev) FREE(prev); inst = next_inst;
prev = here; }
} FREE(mod);
if(prev) FREE(prev); mod = next_mod;
} }
if(oldmod) FREE(oldmod);
*model = NULL; *inModel = NULL;
return;
} }

View File

@ -3,8 +3,6 @@ Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1985 Thomas L. Quarles Author: 1985 Thomas L. Quarles
Modified: September 2003 Paolo Nenzi Modified: September 2003 Paolo Nenzi
**********/ **********/
/*
*/
#include "ngspice/ngspice.h" #include "ngspice/ngspice.h"
#include "capdefs.h" #include "capdefs.h"
@ -13,25 +11,20 @@ Modified: September 2003 Paolo Nenzi
void void
CAPdestroy(GENmodel **inModel) CAPdestroy(GENmodel **inModel)
{ {
CAPmodel *mod = *(CAPmodel**) inModel;
CAPmodel **model = (CAPmodel**)inModel; while (mod) {
CAPinstance *here; CAPmodel *next_mod = mod->CAPnextModel;
CAPinstance *prev = NULL; CAPinstance *inst = mod->CAPinstances;
CAPmodel *mod = *model; while (inst) {
CAPmodel *oldmod = NULL; CAPinstance *next_inst = inst->CAPnextInstance;
FREE(inst);
for( ; mod ; mod = mod->CAPnextModel) { inst = next_inst;
if(oldmod) FREE(oldmod);
oldmod = mod;
prev = NULL;
for(here = mod->CAPinstances ; here ; here = here->CAPnextInstance) {
if(prev) FREE(prev);
prev = here;
} }
if(prev) FREE(prev); FREE(mod);
mod = next_mod;
} }
if(oldmod) FREE(oldmod);
*model = NULL; *inModel = NULL;
} }

View File

@ -2,8 +2,6 @@
Copyright 1990 Regents of the University of California. All rights reserved. Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1985 Thomas L. Quarles Author: 1985 Thomas L. Quarles
**********/ **********/
/*
*/
#include "ngspice/ngspice.h" #include "ngspice/ngspice.h"
#include "cccsdefs.h" #include "cccsdefs.h"
@ -12,24 +10,20 @@ Author: 1985 Thomas L. Quarles
void void
CCCSdestroy(GENmodel **inModel) CCCSdestroy(GENmodel **inModel)
{ {
CCCSmodel **model = (CCCSmodel**)inModel; CCCSmodel *mod = *(CCCSmodel**) inModel;
CCCSinstance *here;
CCCSinstance *prev = NULL;
CCCSmodel *mod = *model;
CCCSmodel *oldmod = NULL;
for( ; mod ; mod = mod->CCCSnextModel) { while (mod) {
if(oldmod) FREE(oldmod); CCCSmodel *next_mod = mod->CCCSnextModel;
oldmod = mod; CCCSinstance *inst = mod->CCCSinstances;
prev = NULL; while (inst) {
for(here = mod->CCCSinstances ; here ; here = here->CCCSnextInstance) { CCCSinstance *next_inst = inst->CCCSnextInstance;
if(prev) FREE(prev); FREE(inst);
prev = here; inst = next_inst;
} }
if(prev) FREE(prev); FREE(mod);
mod = next_mod;
} }
if(oldmod) FREE(oldmod);
*model = NULL; *inModel = NULL;
} }

View File

@ -2,8 +2,6 @@
Copyright 1990 Regents of the University of California. All rights reserved. Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1985 Thomas L. Quarles Author: 1985 Thomas L. Quarles
**********/ **********/
/*
*/
#include "ngspice/ngspice.h" #include "ngspice/ngspice.h"
#include "ccvsdefs.h" #include "ccvsdefs.h"
@ -13,22 +11,19 @@ Author: 1985 Thomas L. Quarles
void void
CCVSdestroy(GENmodel **inModel) CCVSdestroy(GENmodel **inModel)
{ {
CCVSmodel **model = (CCVSmodel**)inModel; CCVSmodel *mod = *(CCVSmodel**) inModel;
CCVSinstance *here;
CCVSinstance *prev = NULL;
CCVSmodel *mod = *model;
CCVSmodel *oldmod = NULL;
for( ; mod ; mod = mod->CCVSnextModel) { while (mod) {
if(oldmod) FREE(oldmod); CCVSmodel *next_mod = mod->CCVSnextModel;
oldmod = mod; CCVSinstance *inst = mod->CCVSinstances;
prev = NULL; while (inst) {
for(here = mod->CCVSinstances ; here ; here = here->CCVSnextInstance) { CCVSinstance *next_inst = inst->CCVSnextInstance;
if(prev) FREE(prev); FREE(inst);
prev = here; inst = next_inst;
} }
if(prev) FREE(prev); FREE(mod);
mod = next_mod;
} }
if(oldmod) FREE(oldmod);
*model = NULL; *inModel = NULL;
} }

View File

@ -8,25 +8,23 @@ Author: 1992 Charles Hough
#include "cpldefs.h" #include "cpldefs.h"
#include "ngspice/suffix.h" #include "ngspice/suffix.h"
void void
CPLdestroy(GENmodel **inModel) CPLdestroy(GENmodel **inModel)
{ {
CPLmodel **model = (CPLmodel **)inModel; CPLmodel *mod = *(CPLmodel **) inModel;
CPLinstance *here;
CPLinstance *prev = NULL;
CPLmodel *mod = *model;
CPLmodel *oldmod = NULL;
for( ; mod ; mod = mod->CPLnextModel) { while (mod) {
if(oldmod) FREE(oldmod); CPLmodel *next_mod = mod->CPLnextModel;
oldmod = mod; CPLinstance *inst = mod->CPLinstances;
prev = NULL; while (inst) {
for(here = mod->CPLinstances ; here ; here = here->CPLnextInstance) { CPLinstance *next_inst = inst->CPLnextInstance;
if(prev) FREE(prev); FREE(inst);
prev = here; inst = next_inst;
} }
if(prev) FREE(prev); FREE(mod);
mod = next_mod;
} }
if(oldmod) FREE(oldmod);
*model = NULL; *inModel = NULL;
} }

View File

@ -2,8 +2,6 @@
Copyright 1990 Regents of the University of California. All rights reserved. Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1985 Gordon Jacobs Author: 1985 Gordon Jacobs
**********/ **********/
/*
*/
#include "ngspice/ngspice.h" #include "ngspice/ngspice.h"
#include "cswdefs.h" #include "cswdefs.h"
@ -13,22 +11,19 @@ Author: 1985 Gordon Jacobs
void void
CSWdestroy(GENmodel **inModel) CSWdestroy(GENmodel **inModel)
{ {
CSWmodel **model = (CSWmodel**)inModel; CSWmodel *mod = *(CSWmodel**) inModel;
CSWinstance *here;
CSWinstance *prev = NULL;
CSWmodel *mod = *model;
CSWmodel *oldmod = NULL;
for( ; mod ; mod = mod->CSWnextModel) { while (mod) {
if(oldmod) FREE(oldmod); CSWmodel *next_mod = mod->CSWnextModel;
oldmod = mod; CSWinstance *inst = mod->CSWinstances;
prev = NULL; while (inst) {
for(here = mod->CSWinstances ; here ; here = here->CSWnextInstance) { CSWinstance *next_inst = inst->CSWnextInstance;
if(prev) FREE(prev); FREE(inst);
prev = here; inst = next_inst;
} }
if(prev) FREE(prev); FREE(mod);
mod = next_mod;
} }
if(oldmod) FREE(oldmod);
*model = NULL; *inModel = NULL;
} }

View File

@ -2,8 +2,6 @@
Copyright 1990 Regents of the University of California. All rights reserved. Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1985 Thomas L. Quarles Author: 1985 Thomas L. Quarles
**********/ **********/
/*
*/
#include "ngspice/ngspice.h" #include "ngspice/ngspice.h"
#include "diodefs.h" #include "diodefs.h"
@ -13,22 +11,19 @@ Author: 1985 Thomas L. Quarles
void void
DIOdestroy(GENmodel **inModel) DIOdestroy(GENmodel **inModel)
{ {
DIOmodel **model = (DIOmodel**)inModel; DIOmodel *mod = *(DIOmodel**) inModel;
DIOinstance *here;
DIOinstance *prev = NULL;
DIOmodel *mod = *model;
DIOmodel *oldmod = NULL;
for( ; mod ; mod = mod->DIOnextModel) { while (mod) {
if(oldmod) FREE(oldmod); DIOmodel *next_mod = mod->DIOnextModel;
oldmod = mod; DIOinstance *inst = mod->DIOinstances;
prev = NULL; while (inst) {
for(here = mod->DIOinstances ; here ; here = here->DIOnextInstance) { DIOinstance *next_inst = inst->DIOnextInstance;
if(prev) FREE(prev); FREE(inst);
prev = here; inst = next_inst;
} }
if(prev) FREE(prev); FREE(mod);
mod = next_mod;
} }
if(oldmod) FREE(oldmod);
*model = NULL; *inModel = NULL;
} }

View File

@ -11,23 +11,19 @@ Modified: Paolo Nenzi
void void
HFETAdestroy(GENmodel **inModel) HFETAdestroy(GENmodel **inModel)
{ {
HFETAmodel **model = (HFETAmodel**)inModel; HFETAmodel *mod = *(HFETAmodel**) inModel;
HFETAinstance *here;
HFETAinstance *prev = NULL;
HFETAmodel *mod = *model;
HFETAmodel *oldmod = NULL;
for( ; mod ; mod = mod->HFETAnextModel) { while (mod) {
if(oldmod) FREE(oldmod); HFETAmodel *next_mod = mod->HFETAnextModel;
oldmod = mod; HFETAinstance *inst = mod->HFETAinstances;
prev = NULL; while (inst) {
for(here = mod->HFETAinstances ; here ; here = here->HFETAnextInstance) { HFETAinstance *next_inst = inst->HFETAnextInstance;
if(prev) FREE(prev); FREE(inst);
prev = here; inst = next_inst;
} }
if(prev) FREE(prev); FREE(mod);
mod = next_mod;
} }
if(oldmod) FREE(oldmod);
*model = NULL; *inModel = NULL;
return;
} }

View File

@ -8,27 +8,22 @@ Modified: Paolo Nenzi
#include "ngspice/suffix.h" #include "ngspice/suffix.h"
void HFET2destroy(GENmodel **inModel) void
HFET2destroy(GENmodel **inModel)
{ {
HFET2model *mod = *(HFET2model**) inModel;
HFET2model **model = (HFET2model**)inModel; while (mod) {
HFET2instance *here; HFET2model *next_mod = mod->HFET2nextModel;
HFET2instance *prev = NULL; HFET2instance *inst = mod->HFET2instances;
HFET2model *mod = *model; while (inst) {
HFET2model *oldmod = NULL; HFET2instance *next_inst = inst->HFET2nextInstance;
FREE(inst);
for( ; mod ; mod = mod->HFET2nextModel) { inst = next_inst;
if(oldmod) FREE(oldmod); }
oldmod = mod; FREE(mod);
prev = NULL; mod = next_mod;
for(here = mod->HFET2instances ; here ; here = here->HFET2nextInstance) {
if(prev) FREE(prev);
prev = here;
} }
if(prev) FREE(prev);
} *inModel = NULL;
if(oldmod) FREE(oldmod);
*model = NULL;
return;
} }

View File

@ -5,12 +5,12 @@
MODEL NAME : HiSIM MODEL NAME : HiSIM
( VERSION : 2 SUBVERSION : 8 REVISION : 0 ) ( VERSION : 2 SUBVERSION : 8 REVISION : 0 )
FILE : hsm2dest.c FILE : hsm2dest.c
Date : 2014.6.5 Date : 2014.6.5
released by released by
Hiroshima University & Hiroshima University &
Semiconductor Technology Academic Research Center (STARC) Semiconductor Technology Academic Research Center (STARC)
***********************************************************************/ ***********************************************************************/
@ -31,8 +31,8 @@ support. Hiroshima University or STARC and its employees are not liable
for the condition or performance of the software. for the condition or performance of the software.
Hiroshima University and STARC own the copyright and grant users a perpetual, Hiroshima University and STARC own the copyright and grant users a perpetual,
irrevocable, worldwide, non-exclusive, royalty-free license with respect irrevocable, worldwide, non-exclusive, royalty-free license with respect
to the software as set forth below. to the software as set forth below.
Hiroshima University and STARC hereby disclaim all implied warranties. Hiroshima University and STARC hereby disclaim all implied warranties.
@ -58,32 +58,28 @@ to others."
#include "hsm2def.h" #include "hsm2def.h"
#include "ngspice/suffix.h" #include "ngspice/suffix.h"
void HSM2destroy(
GENmodel **inModel)
{
HSM2model **model = (HSM2model**)inModel;
HSM2instance *here;
HSM2instance *prev = NULL;
HSM2model *mod = *model;
HSM2model *oldmod = NULL;
for ( ;mod ;mod = mod->HSM2nextModel ) {
if (oldmod) FREE(oldmod);
oldmod = mod;
prev = (HSM2instance *)NULL;
for ( here = mod->HSM2instances ;here ;here = here->HSM2nextInstance ) {
if (prev) FREE(prev);
prev = here;
}
if (prev) FREE(prev);
}
if (oldmod) {
#ifdef USE_OMP
/* free just once for all models */
FREE(oldmod->HSM2InstanceArray);
#endif
FREE(oldmod);
}
*model = NULL;
}
void
HSM2destroy(GENmodel **inModel)
{
HSM2model *mod = *(HSM2model**) inModel;
#ifdef USE_OMP
/* free just once for all models */
FREE(mod->HSM2InstanceArray);
#endif
while (mod) {
HSM2model *next_mod = mod->HSM2nextModel;
HSM2instance *inst = mod->HSM2instances;
while (inst) {
HSM2instance *next_inst = inst->HSM2nextInstance;
FREE(inst);
inst = next_inst;
}
FREE(mod);
mod = next_mod;
}
*inModel = NULL;
}

View File

@ -3,14 +3,14 @@
HiSIM (Hiroshima University STARC IGFET Model) HiSIM (Hiroshima University STARC IGFET Model)
Copyright (C) 2012 Hiroshima University & STARC Copyright (C) 2012 Hiroshima University & STARC
MODEL NAME : HiSIM_HV MODEL NAME : HiSIM_HV
( VERSION : 1 SUBVERSION : 2 REVISION : 4 ) ( VERSION : 1 SUBVERSION : 2 REVISION : 4 )
Model Parameter VERSION : 1.23 Model Parameter VERSION : 1.23
FILE : hsmhvdest.c FILE : hsmhvdest.c
DATE : 2013.04.30 DATE : 2013.04.30
released by released by
Hiroshima University & Hiroshima University &
Semiconductor Technology Academic Research Center (STARC) Semiconductor Technology Academic Research Center (STARC)
***********************************************************************/ ***********************************************************************/
@ -19,26 +19,23 @@
#include "hsmhvdef.h" #include "hsmhvdef.h"
#include "ngspice/suffix.h" #include "ngspice/suffix.h"
void HSMHVdestroy(
GENmodel **inModel)
{
HSMHVmodel **model = (HSMHVmodel**)inModel;
HSMHVinstance *here;
HSMHVinstance *prev = NULL;
HSMHVmodel *mod = *model;
HSMHVmodel *oldmod = NULL;
for ( ;mod ;mod = mod->HSMHVnextModel ) {
if (oldmod) FREE(oldmod);
oldmod = mod;
prev = (HSMHVinstance *)NULL;
for ( here = mod->HSMHVinstances ;here ;here = here->HSMHVnextInstance ) {
if (prev) FREE(prev);
prev = here;
}
if (prev) FREE(prev);
}
if (oldmod) FREE(oldmod);
*model = NULL;
}
void
HSMHVdestroy(GENmodel **inModel)
{
HSMHVmodel *mod = *(HSMHVmodel**) inModel;
while (mod) {
HSMHVmodel *next_mod = mod->HSMHVnextModel;
HSMHVinstance *inst = mod->HSMHVinstances;
while (inst) {
HSMHVinstance *next_inst = inst->HSMHVnextInstance;
FREE(inst);
inst = next_inst;
}
FREE(mod);
mod = next_mod;
}
*inModel = NULL;
}

View File

@ -3,14 +3,14 @@
HiSIM (Hiroshima University STARC IGFET Model) HiSIM (Hiroshima University STARC IGFET Model)
Copyright (C) 2014 Hiroshima University & STARC Copyright (C) 2014 Hiroshima University & STARC
MODEL NAME : HiSIM_HV MODEL NAME : HiSIM_HV
( VERSION : 2 SUBVERSION : 2 REVISION : 0 ) ( VERSION : 2 SUBVERSION : 2 REVISION : 0 )
Model Parameter 'VERSION' : 2.20 Model Parameter 'VERSION' : 2.20
FILE : hsmhvdest.c FILE : hsmhvdest.c
DATE : 2014.6.11 DATE : 2014.6.11
released by released by
Hiroshima University & Hiroshima University &
Semiconductor Technology Academic Research Center (STARC) Semiconductor Technology Academic Research Center (STARC)
***********************************************************************/ ***********************************************************************/
@ -31,8 +31,8 @@ support. Hiroshima University or STARC and its employees are not liable
for the condition or performance of the software. for the condition or performance of the software.
Hiroshima University and STARC own the copyright and grant users a perpetual, Hiroshima University and STARC own the copyright and grant users a perpetual,
irrevocable, worldwide, non-exclusive, royalty-free license with respect irrevocable, worldwide, non-exclusive, royalty-free license with respect
to the software as set forth below. to the software as set forth below.
Hiroshima University and STARC hereby disclaims all implied warranties. Hiroshima University and STARC hereby disclaims all implied warranties.
@ -54,33 +54,30 @@ to others."
Toshimasa Asahara, President, Hiroshima University Toshimasa Asahara, President, Hiroshima University
Mitiko Miura-Mattausch, Professor, Hiroshima University Mitiko Miura-Mattausch, Professor, Hiroshima University
Katsuhiro Shimohigashi, President&CEO, STARC Katsuhiro Shimohigashi, President&CEO, STARC
June 2008 (revised October 2011) June 2008 (revised October 2011)
*************************************************************************/ *************************************************************************/
#include "ngspice/ngspice.h" #include "ngspice/ngspice.h"
#include "hsmhv2def.h" #include "hsmhv2def.h"
#include "ngspice/suffix.h" #include "ngspice/suffix.h"
void HSMHV2destroy(
GENmodel **inModel)
{
HSMHV2model **model = (HSMHV2model**)inModel;
HSMHV2instance *here;
HSMHV2instance *prev = NULL;
HSMHV2model *mod = *model;
HSMHV2model *oldmod = NULL;
for ( ;mod ;mod = mod->HSMHV2nextModel ) {
if (oldmod) FREE(oldmod);
oldmod = mod;
prev = (HSMHV2instance *)NULL;
for ( here = mod->HSMHV2instances ;here ;here = here->HSMHV2nextInstance ) {
if (prev) FREE(prev);
prev = here;
}
if (prev) FREE(prev);
}
if (oldmod) FREE(oldmod);
*model = NULL;
}
void
HSMHV2destroy(GENmodel **inModel)
{
HSMHV2model *mod = *(HSMHV2model**) inModel;
while (mod) {
HSMHV2model *next_mod = mod->HSMHV2nextModel;
HSMHV2instance *inst = mod->HSMHV2instances;
while (inst) {
HSMHV2instance *next_inst = inst->HSMHV2nextInstance;
FREE(inst);
inst = next_inst;
}
FREE(mod);
mod = next_mod;
}
*inModel = NULL;
}

View File

@ -2,8 +2,6 @@
Copyright 1990 Regents of the University of California. All rights reserved. Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1985 Thomas L. Quarles Author: 1985 Thomas L. Quarles
**********/ **********/
/*
*/
#include "ngspice/ngspice.h" #include "ngspice/ngspice.h"
#include "inddefs.h" #include "inddefs.h"
@ -13,22 +11,19 @@ Author: 1985 Thomas L. Quarles
void void
INDdestroy(GENmodel **inModel) INDdestroy(GENmodel **inModel)
{ {
INDmodel **model = (INDmodel**)inModel; INDmodel *mod = *(INDmodel**) inModel;
INDinstance *here;
INDinstance *prev = NULL;
INDmodel *mod = *model;
INDmodel *oldmod = NULL;
for( ; mod ; mod = mod->INDnextModel) { while (mod) {
if(oldmod) FREE(oldmod); INDmodel *next_mod = mod->INDnextModel;
oldmod = mod; INDinstance *inst = mod->INDinstances;
prev = NULL; while (inst) {
for(here = mod->INDinstances ; here ; here = here->INDnextInstance) { INDinstance *next_inst = inst->INDnextInstance;
if(prev) FREE(prev); FREE(inst);
prev = here; inst = next_inst;
} }
if(prev) FREE(prev); FREE(mod);
mod = next_mod;
} }
if(oldmod) FREE(oldmod);
*model = NULL; *inModel = NULL;
} }

View File

@ -2,8 +2,6 @@
Copyright 1990 Regents of the University of California. All rights reserved. Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1985 Thomas L. Quarles Author: 1985 Thomas L. Quarles
**********/ **********/
/*
*/
#include "ngspice/ngspice.h" #include "ngspice/ngspice.h"
#include "inddefs.h" #include "inddefs.h"
@ -11,26 +9,25 @@ Author: 1985 Thomas L. Quarles
#ifdef MUTUAL #ifdef MUTUAL
void void
MUTdestroy(GENmodel **inModel) MUTdestroy(GENmodel **inModel)
{ {
MUTmodel **model = (MUTmodel**)inModel; MUTmodel *mod = *(MUTmodel**) inModel;
MUTinstance *here;
MUTinstance *prev = NULL;
MUTmodel *mod = *model;
MUTmodel *oldmod = NULL;
for( ; mod ; mod = mod->MUTnextModel) { while (mod) {
if(oldmod) FREE(oldmod); MUTmodel *next_mod = mod->MUTnextModel;
oldmod = mod; MUTinstance *inst = mod->MUTinstances;
prev = NULL; while (inst) {
for(here = mod->MUTinstances ; here ; here = here->MUTnextInstance) { MUTinstance *next_inst = inst->MUTnextInstance;
if(prev) FREE(prev); FREE(inst);
prev = here; inst = next_inst;
} }
if(prev) FREE(prev); FREE(mod);
mod = next_mod;
} }
if(oldmod) FREE(oldmod);
*model = NULL; *inModel = NULL;
} }
#endif /* MUTUAL */
#endif

View File

@ -2,8 +2,6 @@
Copyright 1990 Regents of the University of California. All rights reserved. Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1985 Thomas L. Quarles Author: 1985 Thomas L. Quarles
**********/ **********/
/*
*/
#include "ngspice/ngspice.h" #include "ngspice/ngspice.h"
#include "isrcdefs.h" #include "isrcdefs.h"
@ -13,25 +11,20 @@ Author: 1985 Thomas L. Quarles
void void
ISRCdestroy(GENmodel **inModel) ISRCdestroy(GENmodel **inModel)
{ {
ISRCmodel **model = (ISRCmodel**)inModel; ISRCmodel *mod = *(ISRCmodel**) inModel;
ISRCinstance *here;
ISRCinstance *prev = NULL;
ISRCmodel *mod = *model;
ISRCmodel *oldmod = NULL;
for( ; mod ; mod = mod->ISRCnextModel) { while (mod) {
if(oldmod) FREE(oldmod); ISRCmodel *next_mod = mod->ISRCnextModel;
oldmod = mod; ISRCinstance *inst = mod->ISRCinstances;
prev = NULL; while (inst) {
for(here = mod->ISRCinstances ; here ; here = here->ISRCnextInstance) { ISRCinstance *next_inst = inst->ISRCnextInstance;
if(prev) { FREE(inst->ISRCcoeffs);
tfree(prev->ISRCcoeffs); FREE(inst);
FREE(prev); inst = next_inst;
}
prev = here;
} }
if(prev) FREE(prev); FREE(mod);
mod = next_mod;
} }
if(oldmod) FREE(oldmod);
*model = NULL; *inModel = NULL;
} }

View File

@ -2,8 +2,6 @@
Copyright 1990 Regents of the University of California. All rights reserved. Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1985 Thomas L. Quarles Author: 1985 Thomas L. Quarles
**********/ **********/
/*
*/
#include "ngspice/ngspice.h" #include "ngspice/ngspice.h"
#include "jfetdefs.h" #include "jfetdefs.h"
@ -13,22 +11,19 @@ Author: 1985 Thomas L. Quarles
void void
JFETdestroy(GENmodel **inModel) JFETdestroy(GENmodel **inModel)
{ {
JFETmodel **model = (JFETmodel**)inModel; JFETmodel *mod = *(JFETmodel**) inModel;
JFETinstance *here;
JFETinstance *prev = NULL;
JFETmodel *mod = *model;
JFETmodel *oldmod = NULL;
for( ; mod ; mod = mod->JFETnextModel) { while (mod) {
if(oldmod) FREE(oldmod); JFETmodel *next_mod = mod->JFETnextModel;
oldmod = mod; JFETinstance *inst = mod->JFETinstances;
prev = NULL; while (inst) {
for(here = mod->JFETinstances ; here ; here = here->JFETnextInstance) { JFETinstance *next_inst = inst->JFETnextInstance;
if(prev) FREE(prev); FREE(inst);
prev = here; inst = next_inst;
} }
if(prev) FREE(prev); FREE(mod);
mod = next_mod;
} }
if(oldmod) FREE(oldmod);
*model = NULL; *inModel = NULL;
} }

View File

@ -6,8 +6,6 @@ Author: 1985 Thomas L. Quarles
Modified to jfet2 for PS model definition ( Anthony E. Parker ) Modified to jfet2 for PS model definition ( Anthony E. Parker )
Copyright 1994 Macquarie University, Sydney Australia. Copyright 1994 Macquarie University, Sydney Australia.
**********/ **********/
/*
*/
#include "ngspice/ngspice.h" #include "ngspice/ngspice.h"
#include "jfet2defs.h" #include "jfet2defs.h"
@ -17,22 +15,19 @@ Modified to jfet2 for PS model definition ( Anthony E. Parker )
void void
JFET2destroy(GENmodel **inModel) JFET2destroy(GENmodel **inModel)
{ {
JFET2model **model = (JFET2model**)inModel; JFET2model *mod = *(JFET2model**) inModel;
JFET2instance *here;
JFET2instance *prev = NULL;
JFET2model *mod = *model;
JFET2model *oldmod = NULL;
for( ; mod ; mod = mod->JFET2nextModel) { while (mod) {
if(oldmod) FREE(oldmod); JFET2model *next_mod = mod->JFET2nextModel;
oldmod = mod; JFET2instance *inst = mod->JFET2instances;
prev = NULL; while (inst) {
for(here = mod->JFET2instances ; here ; here = here->JFET2nextInstance) { JFET2instance *next_inst = inst->JFET2nextInstance;
if(prev) FREE(prev); FREE(inst);
prev = here; inst = next_inst;
} }
if(prev) FREE(prev); FREE(mod);
mod = next_mod;
} }
if(oldmod) FREE(oldmod);
*model = NULL; *inModel = NULL;
} }

View File

@ -7,29 +7,23 @@ Author: 1990 Jaijeet S. Roychowdhury
#include "ltradefs.h" #include "ltradefs.h"
#include "ngspice/suffix.h" #include "ngspice/suffix.h"
void void
LTRAdestroy(GENmodel **inModel) LTRAdestroy(GENmodel **inModel)
{ {
LTRAmodel **model = (LTRAmodel **) inModel; LTRAmodel *mod = *(LTRAmodel **) inModel;
LTRAinstance *here;
LTRAinstance *prev = NULL;
LTRAmodel *mod = *model;
LTRAmodel *oldmod = NULL;
for (; mod; mod = mod->LTRAnextModel) { while (mod) {
if (oldmod) LTRAmodel *next_mod = mod->LTRAnextModel;
FREE(oldmod); LTRAinstance *inst = mod->LTRAinstances;
oldmod = mod; while (inst) {
prev = NULL; LTRAinstance *next_inst = inst->LTRAnextInstance;
for (here = mod->LTRAinstances; here; here = here->LTRAnextInstance) { FREE(inst);
if (prev) inst = next_inst;
FREE(prev); }
prev = here; FREE(mod);
mod = next_mod;
} }
if (prev)
FREE(prev); *inModel = NULL;
}
if (oldmod)
FREE(oldmod);
*model = NULL;
} }

View File

@ -2,8 +2,6 @@
Copyright 1990 Regents of the University of California. All rights reserved. Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1985 S. Hwang Author: 1985 S. Hwang
**********/ **********/
/*
*/
#include "ngspice/ngspice.h" #include "ngspice/ngspice.h"
#include "mesdefs.h" #include "mesdefs.h"
@ -13,22 +11,19 @@ Author: 1985 S. Hwang
void void
MESdestroy(GENmodel **inModel) MESdestroy(GENmodel **inModel)
{ {
MESmodel **model = (MESmodel**)inModel; MESmodel *mod = *(MESmodel**) inModel;
MESinstance *here;
MESinstance *prev = NULL;
MESmodel *mod = *model;
MESmodel *oldmod = NULL;
for( ; mod ; mod = mod->MESnextModel) { while (mod) {
if(oldmod) FREE(oldmod); MESmodel *next_mod = mod->MESnextModel;
oldmod = mod; MESinstance *inst = mod->MESinstances;
prev = NULL; while (inst) {
for(here = mod->MESinstances ; here ; here = here->MESnextInstance) { MESinstance *next_inst = inst->MESnextInstance;
if(prev) FREE(prev); FREE(inst);
prev = here; inst = next_inst;
} }
if(prev) FREE(prev); FREE(mod);
mod = next_mod;
} }
if(oldmod) FREE(oldmod);
*model = NULL; *inModel = NULL;
} }

View File

@ -11,23 +11,19 @@ Author: Trond Ytterdal
void void
MESAdestroy(GENmodel **inModel) MESAdestroy(GENmodel **inModel)
{ {
MESAmodel **model = (MESAmodel**)inModel; MESAmodel *mod = *(MESAmodel**) inModel;
MESAinstance *here;
MESAinstance *prev = NULL;
MESAmodel *mod = *model;
MESAmodel *oldmod = NULL;
for( ; mod ; mod = mod->MESAnextModel) { while (mod) {
if(oldmod) FREE(oldmod); MESAmodel *next_mod = mod->MESAnextModel;
oldmod = mod; MESAinstance *inst = mod->MESAinstances;
prev = NULL; while (inst) {
for(here = mod->MESAinstances ; here ; here = here->MESAnextInstance) { MESAinstance *next_inst = inst->MESAnextInstance;
if(prev) FREE(prev); FREE(inst);
prev = here; inst = next_inst;
} }
if(prev) FREE(prev); FREE(mod);
mod = next_mod;
} }
if(oldmod) FREE(oldmod);
*model = NULL; *inModel = NULL;
return;
} }

View File

@ -2,8 +2,6 @@
Copyright 1990 Regents of the University of California. All rights reserved. Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1985 Thomas L. Quarles Author: 1985 Thomas L. Quarles
**********/ **********/
/*
*/
#include "ngspice/ngspice.h" #include "ngspice/ngspice.h"
#include "mos1defs.h" #include "mos1defs.h"
@ -13,25 +11,20 @@ Author: 1985 Thomas L. Quarles
void void
MOS1destroy(GENmodel **inModel) MOS1destroy(GENmodel **inModel)
{ {
MOS1model **model = (MOS1model**)inModel; MOS1model *mod = *(MOS1model**) inModel;
MOS1instance *here;
MOS1instance *prev = NULL;
MOS1model *mod = *model;
MOS1model *oldmod = NULL;
for( ; mod ; mod = mod->MOS1nextModel) { while (mod) {
if(oldmod) FREE(oldmod); MOS1model *next_mod = mod->MOS1nextModel;
oldmod = mod; MOS1instance *inst = mod->MOS1instances;
prev = NULL; while (inst) {
for(here = mod->MOS1instances ; here ; here = here->MOS1nextInstance) { MOS1instance *next_inst = inst->MOS1nextInstance;
if(prev){ FREE(inst->MOS1sens);
if(prev->MOS1sens) FREE(prev->MOS1sens); FREE(inst);
FREE(prev); inst = next_inst;
}
prev = here;
} }
if(prev) FREE(prev); FREE(mod);
mod = next_mod;
} }
if(oldmod) FREE(oldmod);
*model = NULL; *inModel = NULL;
} }

View File

@ -2,8 +2,6 @@
Copyright 1990 Regents of the University of California. All rights reserved. Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1985 Thomas L. Quarles Author: 1985 Thomas L. Quarles
**********/ **********/
/*
*/
#include "ngspice/ngspice.h" #include "ngspice/ngspice.h"
#include "mos2defs.h" #include "mos2defs.h"
@ -13,25 +11,20 @@ Author: 1985 Thomas L. Quarles
void void
MOS2destroy(GENmodel **inModel) MOS2destroy(GENmodel **inModel)
{ {
MOS2model **model = (MOS2model **)inModel; MOS2model *mod = *(MOS2model **) inModel;
MOS2instance *here;
MOS2instance *prev = NULL;
MOS2model *mod = *model;
MOS2model *oldmod = NULL;
for( ; mod ; mod = mod->MOS2nextModel) { while (mod) {
if(oldmod) FREE(oldmod); MOS2model *next_mod = mod->MOS2nextModel;
oldmod = mod; MOS2instance *inst = mod->MOS2instances;
prev = NULL; while (inst) {
for(here = mod->MOS2instances ; here ; here = here->MOS2nextInstance) { MOS2instance *next_inst = inst->MOS2nextInstance;
if(prev){ FREE(inst->MOS2sens);
if(prev->MOS2sens) FREE(prev->MOS2sens); FREE(inst);
FREE(prev); inst = next_inst;
} }
prev = here; FREE(mod);
} mod = next_mod;
if(prev) FREE(prev);
} }
if(oldmod) FREE(oldmod);
*model = NULL; *inModel = NULL;
} }

View File

@ -2,8 +2,6 @@
Copyright 1990 Regents of the University of California. All rights reserved. Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1985 Thomas L. Quarles Author: 1985 Thomas L. Quarles
**********/ **********/
/*
*/
#include "ngspice/ngspice.h" #include "ngspice/ngspice.h"
#include "mos3defs.h" #include "mos3defs.h"
@ -13,25 +11,20 @@ Author: 1985 Thomas L. Quarles
void void
MOS3destroy(GENmodel **inModel) MOS3destroy(GENmodel **inModel)
{ {
MOS3model **model = (MOS3model **)inModel; MOS3model *mod = *(MOS3model **) inModel;
MOS3instance *here;
MOS3instance *prev = NULL;
MOS3model *mod = *model;
MOS3model *oldmod = NULL;
for( ; mod ; mod = mod->MOS3nextModel) { while (mod) {
if(oldmod) FREE(oldmod); MOS3model *next_mod = mod->MOS3nextModel;
oldmod = mod; MOS3instance *inst = mod->MOS3instances;
prev = NULL; while (inst) {
for(here = mod->MOS3instances ; here ; here = here->MOS3nextInstance) { MOS3instance *next_inst = inst->MOS3nextInstance;
if(prev){ FREE(inst->MOS3sens);
if(prev->MOS3sens) FREE(prev->MOS3sens); FREE(inst);
FREE(prev); inst = next_inst;
}
prev = here;
} }
if(prev) FREE(prev); FREE(mod);
mod = next_mod;
} }
if(oldmod) FREE(oldmod);
*model = NULL; *inModel = NULL;
} }

View File

@ -2,8 +2,6 @@
Copyright 1990 Regents of the University of California. All rights reserved. Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1989 Takayasu Sakurai Author: 1989 Takayasu Sakurai
**********/ **********/
/*
*/
#include "ngspice/ngspice.h" #include "ngspice/ngspice.h"
#include "mos6defs.h" #include "mos6defs.h"
@ -13,25 +11,20 @@ Author: 1989 Takayasu Sakurai
void void
MOS6destroy(GENmodel **inModel) MOS6destroy(GENmodel **inModel)
{ {
MOS6model **model = (MOS6model**)inModel; MOS6model *mod = *(MOS6model**) inModel;
MOS6instance *here;
MOS6instance *prev = NULL;
MOS6model *mod = *model;
MOS6model *oldmod = NULL;
for( ; mod ; mod = mod->MOS6nextModel) { while (mod) {
if(oldmod) FREE(oldmod); MOS6model *next_mod = mod->MOS6nextModel;
oldmod = mod; MOS6instance *inst = mod->MOS6instances;
prev = NULL; while (inst) {
for(here = mod->MOS6instances ; here ; here = here->MOS6nextInstance) { MOS6instance *next_inst = inst->MOS6nextInstance;
if(prev){ FREE(inst->MOS6sens);
if(prev->MOS6sens) FREE(prev->MOS6sens); FREE(inst);
FREE(prev); inst = next_inst;
}
prev = here;
} }
if(prev) FREE(prev); FREE(mod);
mod = next_mod;
} }
if(oldmod) FREE(oldmod);
*model = NULL; *inModel = NULL;
} }

View File

@ -3,8 +3,6 @@ Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1985 Thomas L. Quarles Author: 1985 Thomas L. Quarles
Modified: Alan Gillespie Modified: Alan Gillespie
**********/ **********/
/*
*/
#include "ngspice/ngspice.h" #include "ngspice/ngspice.h"
#include "mos9defs.h" #include "mos9defs.h"
@ -14,25 +12,20 @@ Modified: Alan Gillespie
void void
MOS9destroy(GENmodel **inModel) MOS9destroy(GENmodel **inModel)
{ {
MOS9model **model = (MOS9model **)inModel; MOS9model *mod = *(MOS9model **) inModel;
MOS9instance *here;
MOS9instance *prev = NULL;
MOS9model *mod = *model;
MOS9model *oldmod = NULL;
for( ; mod ; mod = mod->MOS9nextModel) { while (mod) {
if(oldmod) FREE(oldmod); MOS9model *next_mod = mod->MOS9nextModel;
oldmod = mod; MOS9instance *inst = mod->MOS9instances;
prev = NULL; while (inst) {
for(here = mod->MOS9instances ; here ; here = here->MOS9nextInstance) { MOS9instance *next_inst = inst->MOS9nextInstance;
if(prev){ FREE(inst->MOS9sens);
if(prev->MOS9sens) FREE(prev->MOS9sens); FREE(inst);
FREE(prev); inst = next_inst;
}
prev = here;
} }
if(prev) FREE(prev); FREE(mod);
mod = next_mod;
} }
if(oldmod) FREE(oldmod);
*model = NULL; *inModel = NULL;
} }

View File

@ -1,6 +1,6 @@
/********** /**********
Copyright 1992 Regents of the University of California. All rights reserved. Copyright 1992 Regents of the University of California. All rights reserved.
Author: 1987 Kartikeya Mayaram, U. C. Berkeley CAD Group Author: 1987 Kartikeya Mayaram, U. C. Berkeley CAD Group
**********/ **********/
/* /*
@ -14,25 +14,24 @@ Author: 1987 Kartikeya Mayaram, U. C. Berkeley CAD Group
#include "ngspice/cidersupt.h" #include "ngspice/cidersupt.h"
#include "ngspice/suffix.h" #include "ngspice/suffix.h"
void void
NBJTdestroy(GENmodel **inModel) NBJTdestroy(GENmodel **inModel)
{ {
NBJTmodel *mod = *(NBJTmodel **) inModel;
NBJTmodel **model = (NBJTmodel **) inModel; while (mod) {
NBJTmodel *mod, *nextMod; NBJTmodel *next_mod = mod->NBJTnextModel;
NBJTinstance *inst, *nextInst; NBJTinstance *inst = mod->NBJTinstances;
while (inst) {
NBJTinstance *next_inst = inst->NBJTnextInstance;
for (mod = *model; mod;) { ONEdestroy(inst->NBJTpDevice);
for (inst = mod->NBJTinstances; inst;) { FREE(inst);
ONEdestroy(inst->NBJTpDevice); inst = next_inst;
nextInst = inst->NBJTnextInstance; }
FREE(inst); FREE(mod);
inst = nextInst; mod = next_mod;
} }
nextMod = mod->NBJTnextModel;
FREE(mod); *inModel = NULL;
mod = nextMod;
}
*model = NULL;
} }

View File

@ -1,6 +1,6 @@
/********** /**********
Copyright 1992 Regents of the University of California. All rights reserved. Copyright 1992 Regents of the University of California. All rights reserved.
Author: 1987 Kartikeya Mayaram, U. C. Berkeley CAD Group Author: 1987 Kartikeya Mayaram, U. C. Berkeley CAD Group
**********/ **********/
/* /*
@ -14,25 +14,24 @@ Author: 1987 Kartikeya Mayaram, U. C. Berkeley CAD Group
#include "../../../ciderlib/twod/twodext.h" #include "../../../ciderlib/twod/twodext.h"
#include "ngspice/suffix.h" #include "ngspice/suffix.h"
void void
NBJT2destroy(GENmodel **inModel) NBJT2destroy(GENmodel **inModel)
{ {
NBJT2model *mod = *(NBJT2model **) inModel;
NBJT2model **model = (NBJT2model **) inModel; while (mod) {
NBJT2model *mod, *nextMod; NBJT2model *next_mod = mod->NBJT2nextModel;
NBJT2instance *inst, *nextInst; NBJT2instance *inst = mod->NBJT2instances;
while (inst) {
NBJT2instance *next_inst = inst->NBJT2nextInstance;
for (mod = *model; mod;) { TWOdestroy(inst->NBJT2pDevice);
for (inst = mod->NBJT2instances; inst;) { FREE(inst);
TWOdestroy(inst->NBJT2pDevice); inst = next_inst;
nextInst = inst->NBJT2nextInstance; }
FREE(inst); FREE(mod);
inst = nextInst; mod = next_mod;
} }
nextMod = mod->NBJT2nextModel;
FREE(mod); *inModel = NULL;
mod = nextMod;
}
*model = NULL;
} }

View File

@ -1,36 +1,32 @@
/********** /**********
Permit to use it as your wish. Permit to use it as your wish.
Author: 2007 Gong Ding, gdiso@ustc.edu Author: 2007 Gong Ding, gdiso@ustc.edu
University of Science and Technology of China University of Science and Technology of China
**********/ **********/
#include "ngspice/ngspice.h" #include "ngspice/ngspice.h"
#include "ndevdefs.h" #include "ndevdefs.h"
#include "ngspice/suffix.h" #include "ngspice/suffix.h"
void void
NDEVdestroy(GENmodel **inModel) NDEVdestroy(GENmodel **inModel)
{ {
NDEVmodel *mod = *(NDEVmodel **) inModel;
NDEVmodel **model = (NDEVmodel **)inModel;
NDEVinstance *here;
NDEVinstance *prev = NULL;
NDEVmodel *mod = *model;
NDEVmodel *oldmod = NULL;
for( ; mod ; mod = mod->NDEVnextModel) { while (mod) {
if(oldmod) FREE(oldmod); NDEVmodel *next_mod = mod->NDEVnextModel;
oldmod = mod; NDEVinstance *inst = mod->NDEVinstances;
prev = NULL; while (inst) {
for(here = mod->NDEVinstances ; here ; here = here->NDEVnextInstance) { NDEVinstance *next_inst = inst->NDEVnextInstance;
if(prev) FREE(prev); FREE(inst);
prev = here; inst = next_inst;
} }
if(prev) FREE(prev); close(mod->sock);
close(mod->sock); printf("Disconnect to remote NDEV server %s:%d\n", mod->host, mod->port);
fprintf(stdout,"Disconnect to remote NDEV server %s:%d\n",mod->host,mod->port); FREE(mod);
mod = next_mod;
} }
if(oldmod) FREE(oldmod);
*model = NULL; *inModel = NULL;
} }

View File

@ -1,6 +1,6 @@
/********** /**********
Copyright 1992 Regents of the University of California. All rights reserved. Copyright 1992 Regents of the University of California. All rights reserved.
Author: 1987 Kartikeya Mayaram, U. C. Berkeley CAD Group Author: 1987 Kartikeya Mayaram, U. C. Berkeley CAD Group
**********/ **********/
/* /*
@ -14,25 +14,24 @@ Author: 1987 Kartikeya Mayaram, U. C. Berkeley CAD Group
#include "ngspice/cidersupt.h" #include "ngspice/cidersupt.h"
#include "ngspice/suffix.h" #include "ngspice/suffix.h"
void void
NUMDdestroy(GENmodel **inModel) NUMDdestroy(GENmodel **inModel)
{ {
NUMDmodel *mod = *(NUMDmodel **) inModel;
NUMDmodel **model = (NUMDmodel **) inModel; while (mod) {
NUMDmodel *mod, *nextMod; NUMDmodel *next_mod = mod->NUMDnextModel;
NUMDinstance *inst, *nextInst; NUMDinstance *inst = mod->NUMDinstances;
while (inst) {
NUMDinstance *next_inst = inst->NUMDnextInstance;
for (mod = *model; mod;) { ONEdestroy(inst->NUMDpDevice);
for (inst = mod->NUMDinstances; inst;) { FREE(inst);
ONEdestroy(inst->NUMDpDevice); inst = next_inst;
nextInst = inst->NUMDnextInstance; }
FREE(inst); FREE(mod);
inst = nextInst; mod = next_mod;
} }
nextMod = mod->NUMDnextModel;
FREE(mod); *inModel = NULL;
mod = nextMod;
}
*model = NULL;
} }

View File

@ -1,6 +1,6 @@
/********** /**********
Copyright 1992 Regents of the University of California. All rights reserved. Copyright 1992 Regents of the University of California. All rights reserved.
Author: 1987 Kartikeya Mayaram, U. C. Berkeley CAD Group Author: 1987 Kartikeya Mayaram, U. C. Berkeley CAD Group
**********/ **********/
/* /*
@ -15,25 +15,24 @@ Author: 1987 Kartikeya Mayaram, U. C. Berkeley CAD Group
#include "ngspice/cidersupt.h" #include "ngspice/cidersupt.h"
#include "ngspice/suffix.h" #include "ngspice/suffix.h"
void void
NUMD2destroy(GENmodel **inModel) NUMD2destroy(GENmodel **inModel)
{ {
NUMD2model *mod = *(NUMD2model **) inModel;
NUMD2model **model = (NUMD2model **) inModel; while (mod) {
NUMD2model *mod, *nextMod; NUMD2model *next_mod = mod->NUMD2nextModel;
NUMD2instance *inst, *nextInst; NUMD2instance *inst = mod->NUMD2instances;
while (inst) {
NUMD2instance *next_inst = inst->NUMD2nextInstance;
for (mod = *model; mod;) { TWOdestroy(inst->NUMD2pDevice);
for (inst = mod->NUMD2instances; inst;) { FREE(inst);
TWOdestroy(inst->NUMD2pDevice); inst = next_inst;
nextInst = inst->NUMD2nextInstance; }
FREE(inst); FREE(mod);
inst = nextInst; mod = next_mod;
} }
nextMod = mod->NUMD2nextModel;
FREE(mod); *inModel = NULL;
mod = nextMod;
}
*model = NULL;
} }

View File

@ -1,6 +1,6 @@
/********** /**********
Copyright 1991 Regents of the University of California. All rights reserved. Copyright 1991 Regents of the University of California. All rights reserved.
Author: 1987 Kartikeya Mayaram, U. C. Berkeley CAD Group Author: 1987 Kartikeya Mayaram, U. C. Berkeley CAD Group
**********/ **********/
/* /*
@ -14,24 +14,24 @@ Author: 1987 Kartikeya Mayaram, U. C. Berkeley CAD Group
#include "../../../ciderlib/twod/twodext.h" #include "../../../ciderlib/twod/twodext.h"
#include "ngspice/suffix.h" #include "ngspice/suffix.h"
void void
NUMOSdestroy(GENmodel **inModel) NUMOSdestroy(GENmodel **inModel)
{ {
NUMOSmodel *mod = *(NUMOSmodel **) inModel;
NUMOSmodel **model = (NUMOSmodel **) inModel; while (mod) {
NUMOSmodel *mod, *nextMod; NUMOSmodel *next_mod = mod->NUMOSnextModel;
NUMOSinstance *inst, *nextInst; NUMOSinstance *inst = mod->NUMOSinstances;
while (inst) {
for (mod = *model; mod;) { NUMOSinstance *next_inst = inst->NUMOSnextInstance;
for (inst = mod->NUMOSinstances; inst;) { TWOdestroy(inst->NUMOSpDevice);
TWOdestroy(inst->NUMOSpDevice); FREE(inst);
nextInst = inst->NUMOSnextInstance; inst = next_inst;
FREE(inst); }
inst = nextInst; FREE(mod);
mod = next_mod;
} }
nextMod = mod->NUMOSnextModel;
FREE(mod); *inModel = NULL;
mod = nextMod;
}
*model = NULL;
} }

View File

@ -3,8 +3,6 @@ Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1985 Thomas L. Quarles Author: 1985 Thomas L. Quarles
Modified: Apr 2000 - Paolo Nenzi Modified: Apr 2000 - Paolo Nenzi
**********/ **********/
/*
*/
#include "ngspice/ngspice.h" #include "ngspice/ngspice.h"
#include "resdefs.h" #include "resdefs.h"
@ -13,22 +11,19 @@ Modified: Apr 2000 - Paolo Nenzi
void void
RESdestroy(GENmodel **inModel) RESdestroy(GENmodel **inModel)
{ {
RESmodel **model = (RESmodel **)inModel; RESmodel *mod = *(RESmodel **) inModel;
RESinstance *here;
RESinstance *prev = NULL;
RESmodel *mod = *model;
RESmodel *oldmod = NULL;
for( ; mod ; mod = mod->RESnextModel) { while (mod) {
if(oldmod) FREE(oldmod); RESmodel *next_mod = mod->RESnextModel;
oldmod = mod; RESinstance *inst = mod->RESinstances;
prev = NULL; while (inst) {
for(here = mod->RESinstances ; here ; here = here->RESnextInstance) { RESinstance *next_inst = inst->RESnextInstance;
if(prev) FREE(prev); FREE(inst);
prev = here; inst = next_inst;
} }
if(prev) FREE(prev); FREE(mod);
mod = next_mod;
} }
if(oldmod) FREE(oldmod);
*model = NULL; *inModel = NULL;
} }

View File

@ -15,7 +15,7 @@ With help from : Bernard Tenbroek, Bill Redman-White, Mike Uren, Chris Edwards
Acknowledgements : Rupert Howes and Pete Mole. Acknowledgements : Rupert Howes and Pete Mole.
**********/ **********/
/********** /**********
Modified by Paolo Nenzi 2002 Modified by Paolo Nenzi 2002
ngspice integration ngspice integration
**********/ **********/
@ -28,25 +28,20 @@ ngspice integration
void void
SOI3destroy(GENmodel **inModel) SOI3destroy(GENmodel **inModel)
{ {
SOI3model **model = (SOI3model**)inModel; SOI3model *mod = *(SOI3model**) inModel;
SOI3instance *here;
SOI3instance *prev = NULL;
SOI3model *mod = *model;
SOI3model *oldmod = NULL;
for( ; mod ; mod = mod->SOI3nextModel) { while (mod) {
if(oldmod) FREE(oldmod); SOI3model *next_mod = mod->SOI3nextModel;
oldmod = mod; SOI3instance *inst = mod->SOI3instances;
prev = NULL; while (inst) {
for(here = mod->SOI3instances ; here ; here = here->SOI3nextInstance) { SOI3instance *next_inst = inst->SOI3nextInstance;
if(prev){ /* FREE(inst->SOI3sens); */
/* if(prev->SOI3sens) FREE(prev->SOI3sens); */ FREE(inst);
FREE(prev); inst = next_inst;
}
prev = here;
} }
if(prev) FREE(prev); FREE(mod);
mod = next_mod;
} }
if(oldmod) FREE(oldmod);
*model = NULL; *inModel = NULL;
} }

View File

@ -2,8 +2,6 @@
Copyright 1990 Regents of the University of California. All rights reserved. Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1985 Gordon Jacobs Author: 1985 Gordon Jacobs
**********/ **********/
/*
*/
#include "ngspice/ngspice.h" #include "ngspice/ngspice.h"
#include "swdefs.h" #include "swdefs.h"
@ -13,22 +11,19 @@ Author: 1985 Gordon Jacobs
void void
SWdestroy(GENmodel **inModel) SWdestroy(GENmodel **inModel)
{ {
SWmodel **model = (SWmodel**)inModel; SWmodel *mod = *(SWmodel**) inModel;
SWinstance *here;
SWinstance *prev = NULL;
SWmodel *mod = *model;
SWmodel *oldmod = NULL;
for( ; mod ; mod = mod->SWnextModel) { while (mod) {
if(oldmod) FREE(oldmod); SWmodel *next_mod = mod->SWnextModel;
oldmod = mod; SWinstance *inst = mod->SWinstances;
prev = NULL; while (inst) {
for(here = mod->SWinstances ; here ; here = here->SWnextInstance) { SWinstance *next_inst = inst->SWnextInstance;
if(prev) FREE(prev); FREE(inst);
prev = here; inst = next_inst;
} }
if(prev) FREE(prev); FREE(mod);
mod = next_mod;
} }
if(oldmod) FREE(oldmod);
*model = NULL; *inModel = NULL;
} }

View File

@ -2,8 +2,6 @@
Copyright 1990 Regents of the University of California. All rights reserved. Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1985 Thomas L. Quarles Author: 1985 Thomas L. Quarles
**********/ **********/
/*
*/
#include "ngspice/ngspice.h" #include "ngspice/ngspice.h"
#include "tradefs.h" #include "tradefs.h"
@ -13,22 +11,19 @@ Author: 1985 Thomas L. Quarles
void void
TRAdestroy(GENmodel **inModel) TRAdestroy(GENmodel **inModel)
{ {
TRAmodel **model = (TRAmodel **)inModel; TRAmodel *mod = *(TRAmodel **) inModel;
TRAinstance *here;
TRAinstance *prev = NULL;
TRAmodel *mod = *model;
TRAmodel *oldmod = NULL;
for( ; mod ; mod = mod->TRAnextModel) { while (mod) {
if(oldmod) FREE(oldmod); TRAmodel *next_mod = mod->TRAnextModel;
oldmod = mod; TRAinstance *inst = mod->TRAinstances;
prev = NULL; while (inst) {
for(here = mod->TRAinstances ; here ; here = here->TRAnextInstance) { TRAinstance *next_inst = inst->TRAnextInstance;
if(prev) FREE(prev); FREE(inst);
prev = here; inst = next_inst;
} }
if(prev) FREE(prev); FREE(mod);
mod = next_mod;
} }
if(oldmod) FREE(oldmod);
*model = NULL; *inModel = NULL;
} }

View File

@ -4,7 +4,6 @@ reserved.
Author: 1992 Charles Hough Author: 1992 Charles Hough
**********/ **********/
#include "ngspice/ngspice.h" #include "ngspice/ngspice.h"
#include "txldefs.h" #include "txldefs.h"
#include "ngspice/suffix.h" #include "ngspice/suffix.h"
@ -13,22 +12,19 @@ Author: 1992 Charles Hough
void void
TXLdestroy(GENmodel **inModel) TXLdestroy(GENmodel **inModel)
{ {
TXLmodel **model = (TXLmodel **)inModel; TXLmodel *mod = *(TXLmodel **) inModel;
TXLinstance *here;
TXLinstance *prev = NULL;
TXLmodel *mod = *model;
TXLmodel *oldmod = NULL;
for( ; mod ; mod = mod->TXLnextModel) { while (mod) {
if(oldmod) FREE(oldmod); TXLmodel *next_mod = mod->TXLnextModel;
oldmod = mod; TXLinstance *inst = mod->TXLinstances;
prev = NULL; while (inst) {
for(here = mod->TXLinstances ; here ; here = here->TXLnextInstance) { TXLinstance *next_inst = inst->TXLnextInstance;
if(prev) FREE(prev); FREE(inst);
prev = here; inst = next_inst;
} }
if(prev) FREE(prev); FREE(mod);
mod = next_mod;
} }
if(oldmod) FREE(oldmod);
*model = NULL; *inModel = NULL;
} }

View File

@ -2,9 +2,6 @@
Copyright 1990 Regents of the University of California. All rights reserved. Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1987 Thomas L. Quarles Author: 1987 Thomas L. Quarles
**********/ **********/
/*
*/
#include "ngspice/ngspice.h" #include "ngspice/ngspice.h"
#include "urcdefs.h" #include "urcdefs.h"
@ -14,22 +11,19 @@ Author: 1987 Thomas L. Quarles
void void
URCdestroy(GENmodel **inModel) URCdestroy(GENmodel **inModel)
{ {
URCmodel **model = (URCmodel **)inModel; URCmodel *mod = *(URCmodel **) inModel;
URCinstance *here;
URCinstance *prev = NULL;
URCmodel *mod = *model;
URCmodel *oldmod = NULL;
for( ; mod ; mod = mod->URCnextModel) { while (mod) {
if(oldmod) FREE(oldmod); URCmodel *next_mod = mod->URCnextModel;
oldmod = mod; URCinstance *inst = mod->URCinstances;
prev = NULL; while (inst) {
for(here = mod->URCinstances ; here ; here = here->URCnextInstance) { URCinstance *next_inst = inst->URCnextInstance;
if(prev) FREE(prev); FREE(inst);
prev = here; inst = next_inst;
} }
if(prev) FREE(prev); FREE(mod);
mod = next_mod;
} }
if(oldmod) FREE(oldmod);
*model = NULL; *inModel = NULL;
} }

View File

@ -18,29 +18,20 @@ Spice3 Implementation: 2003 Dietmar Warning DAnalyse GmbH
void void
VBICdestroy(GENmodel **inModel) VBICdestroy(GENmodel **inModel)
{ {
VBICmodel *mod = *(VBICmodel**) inModel;
VBICmodel **model = (VBICmodel**)inModel; while (mod) {
VBICinstance *here; VBICmodel *next_mod = mod->VBICnextModel;
VBICinstance *prev = NULL; VBICinstance *inst = mod->VBICinstances;
VBICmodel *mod = *model; while (inst) {
VBICmodel *oldmod = NULL; VBICinstance *next_inst = inst->VBICnextInstance;
FREE(inst->VBICsens);
for( ; mod ; mod = mod->VBICnextModel) { FREE(inst);
if(oldmod) FREE(oldmod); inst = next_inst;
oldmod = mod;
prev = NULL;
for(here = mod->VBICinstances ; here ; here = here->VBICnextInstance) {
if(prev){
if(prev->VBICsens) FREE(prev->VBICsens);
FREE(prev);
}
prev = here;
}
if(prev){
if(prev->VBICsens) FREE(prev->VBICsens);
FREE(prev);
} }
FREE(mod);
mod = next_mod;
} }
if(oldmod) FREE(oldmod);
*model = NULL; *inModel = NULL;
} }

View File

@ -2,8 +2,6 @@
Copyright 1990 Regents of the University of California. All rights reserved. Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1985 Thomas L. Quarles Author: 1985 Thomas L. Quarles
**********/ **********/
/*
*/
#include "ngspice/ngspice.h" #include "ngspice/ngspice.h"
#include "vccsdefs.h" #include "vccsdefs.h"
@ -13,22 +11,19 @@ Author: 1985 Thomas L. Quarles
void void
VCCSdestroy(GENmodel **inModel) VCCSdestroy(GENmodel **inModel)
{ {
VCCSmodel **model = (VCCSmodel**)inModel; VCCSmodel *mod = *(VCCSmodel**) inModel;
VCCSinstance *here;
VCCSinstance *prev = NULL;
VCCSmodel *mod = *model;
VCCSmodel *oldmod = NULL;
for( ; mod ; mod = mod->VCCSnextModel) { while (mod) {
if(oldmod) FREE(oldmod); VCCSmodel *next_mod = mod->VCCSnextModel;
oldmod = mod; VCCSinstance *inst = mod->VCCSinstances;
prev = NULL; while (inst) {
for(here = mod->VCCSinstances ; here ; here = here->VCCSnextInstance) { VCCSinstance *next_inst = inst->VCCSnextInstance;
if(prev) FREE(prev); FREE(inst);
prev = here; inst = next_inst;
} }
if(prev) FREE(prev); FREE(mod);
mod = next_mod;
} }
if(oldmod) FREE(oldmod);
*model = NULL; *inModel = NULL;
} }

View File

@ -2,8 +2,6 @@
Copyright 1990 Regents of the University of California. All rights reserved. Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1985 Thomas L. Quarles Author: 1985 Thomas L. Quarles
**********/ **********/
/*
*/
#include "ngspice/ngspice.h" #include "ngspice/ngspice.h"
#include "vcvsdefs.h" #include "vcvsdefs.h"
@ -13,22 +11,19 @@ Author: 1985 Thomas L. Quarles
void void
VCVSdestroy(GENmodel **inModel) VCVSdestroy(GENmodel **inModel)
{ {
VCVSmodel **model = (VCVSmodel **)inModel; VCVSmodel *mod = *(VCVSmodel **) inModel;
VCVSinstance *here;
VCVSinstance *prev = NULL;
VCVSmodel *mod = *model;
VCVSmodel *oldmod = NULL;
for( ; mod ; mod = mod->VCVSnextModel) { while (mod) {
if(oldmod) FREE(oldmod); VCVSmodel *next_mod = mod->VCVSnextModel;
oldmod = mod; VCVSinstance *inst = mod->VCVSinstances;
prev = NULL; while (inst) {
for(here = mod->VCVSinstances ; here ; here = here->VCVSnextInstance) { VCVSinstance *next_inst = inst->VCVSnextInstance;
if(prev) FREE(prev); FREE(inst);
prev = here; inst = next_inst;
} }
if(prev) FREE(prev); FREE(mod);
mod = next_mod;
} }
if(oldmod) FREE(oldmod);
*model = NULL; *inModel = NULL;
} }

View File

@ -2,8 +2,6 @@
Copyright 1990 Regents of the University of California. All rights reserved. Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1985 Thomas L. Quarles Author: 1985 Thomas L. Quarles
**********/ **********/
/*
*/
#include "ngspice/ngspice.h" #include "ngspice/ngspice.h"
#include "vsrcdefs.h" #include "vsrcdefs.h"
@ -13,25 +11,20 @@ Author: 1985 Thomas L. Quarles
void void
VSRCdestroy(GENmodel **inModel) VSRCdestroy(GENmodel **inModel)
{ {
VSRCmodel **model = (VSRCmodel**)inModel; VSRCmodel *mod = *(VSRCmodel**) inModel;
VSRCinstance *here;
VSRCinstance *prev = NULL;
VSRCmodel *mod = *model;
VSRCmodel *oldmod = NULL;
for( ; mod ; mod = mod->VSRCnextModel) { while (mod) {
if(oldmod) FREE(oldmod); VSRCmodel *next_mod = mod->VSRCnextModel;
oldmod = mod; VSRCinstance *inst = mod->VSRCinstances;
prev = NULL; while (inst) {
for(here = mod->VSRCinstances ; here ; here = here->VSRCnextInstance) { VSRCinstance *next_inst = inst->VSRCnextInstance;
if(prev) { FREE(inst->VSRCcoeffs);
tfree(prev->VSRCcoeffs); FREE(inst);
FREE(prev); inst = next_inst;
}
prev = here;
} }
if(prev) FREE(prev); FREE(mod);
mod = next_mod;
} }
if(oldmod) FREE(oldmod);
*model = NULL; *inModel = NULL;
} }