Jspice3
b2dest.c
Go to the documentation of this file.
1 /***************************************************************************
2 JSPICE3 adaptation of Spice3f2 - Copyright (c) Stephen R. Whiteley 1992
3 Copyright 1990 Regents of the University of California. All rights reserved.
4 Authors: 1985 Hong June Park, Thomas L. Quarles
5  1993 Stephen R. Whiteley
6 ****************************************************************************/
7 
8 #include "spice.h"
9 #include <stdio.h>
10 #include "bsim2def.h"
11 #include "util.h"
12 
13 
14 void
15 B2destroy(inModel)
16  GENmodel **inModel;
17 
18 {
19 
20  B2model **model = (B2model**)inModel;
21  B2instance *here;
22  B2instance *prev = NULL;
23  B2model *mod = *model;
24  B2model *oldmod = NULL;
25 
26  for( ; mod ; mod = mod->B2nextModel) {
27  if(oldmod) FREE(oldmod);
28  oldmod = mod;
29  prev = (B2instance *)NULL;
30  for(here = mod->B2instances ; here ; here = here->B2nextInstance) {
31  if(prev) FREE(prev);
32  prev = here;
33  }
34  if(prev) FREE(prev);
35  }
36  if(oldmod) FREE(oldmod);
37  *model = NULL;
38 }
39 
B2instance * B2instances
Definition: bsim2def.h:226
struct sBSIM2instance * B2nextInstance
Definition: bsim2def.h:19
void B2destroy(GENmodel **inModel)
Definition: b2dest.c:15
#define FREE(ptr)
Definition: spdefs.h:436
#define NULL
Definition: spdefs.h:121
static char model[32]
Definition: subckt.c:76
struct sBSIM2model * B2nextModel
Definition: bsim2def.h:224