Browse Source

devices/*, USE_OMP, cleanup 'InstanceArray' usage

store 'InstanceArray' in the very first module only,
  NULL it in any other.

FREE() it in every module to treat them all the same in XXXdestroy()
pre-master-46
rlar 8 years ago
parent
commit
f53384da70
  1. 9
      src/spicelib/devices/bsim3/b3dest.c
  2. 8
      src/spicelib/devices/bsim3/b3set.c
  3. 10
      src/spicelib/devices/bsim3v32/b3v32dest.c
  4. 8
      src/spicelib/devices/bsim3v32/b3v32set.c
  5. 10
      src/spicelib/devices/bsim4/b4dest.c
  6. 8
      src/spicelib/devices/bsim4/b4set.c
  7. 10
      src/spicelib/devices/bsim4v5/b4v5dest.c
  8. 8
      src/spicelib/devices/bsim4v5/b4v5set.c
  9. 10
      src/spicelib/devices/bsim4v6/b4v6dest.c
  10. 8
      src/spicelib/devices/bsim4v6/b4v6set.c
  11. 10
      src/spicelib/devices/bsim4v7/b4v7dest.c
  12. 8
      src/spicelib/devices/bsim4v7/b4v7set.c
  13. 10
      src/spicelib/devices/bsimsoi/b4soidest.c
  14. 8
      src/spicelib/devices/bsimsoi/b4soiset.c
  15. 10
      src/spicelib/devices/hisim2/hsm2dest.c
  16. 8
      src/spicelib/devices/hisim2/hsm2set.c

9
src/spicelib/devices/bsim3/b3dest.c

@ -18,11 +18,6 @@ BSIM3destroy(GENmodel **inModel)
{
BSIM3model *mod = *(BSIM3model**) inModel;
#ifdef USE_OMP
/* free just once for all models */
FREE(mod->BSIM3InstanceArray);
#endif
while (mod) {
BSIM3model *next_mod = mod->BSIM3nextModel;
BSIM3instance *inst = mod->BSIM3instances;
@ -42,6 +37,10 @@ BSIM3destroy(GENmodel **inModel)
inst = next_inst;
}
#ifdef USE_OMP
FREE(mod->BSIM3InstanceArray);
#endif
/* mod->BSIM3modName to be freed in INPtabEnd() */
FREE(mod->BSIM3version);
FREE(mod);

8
src/spicelib/devices/bsim3/b3set.c

@ -1137,9 +1137,14 @@ do { if((here->ptr = SMPmakeElt(matrix, here->first, here->second)) == NULL){\
{
InstCount++;
}
model->BSIM3InstCount = 0;
model->BSIM3InstanceArray = NULL;
}
InstArray = TMALLOC(BSIM3instance*, InstCount);
model = (BSIM3model*)inModel;
/* store this in the first model only */
model->BSIM3InstCount = InstCount;
model->BSIM3InstanceArray = InstArray;
idx = 0;
for( ; model != NULL; model = model->BSIM3nextModel )
{
@ -1150,9 +1155,6 @@ do { if((here->ptr = SMPmakeElt(matrix, here->first, here->second)) == NULL){\
InstArray[idx] = here;
idx++;
}
/* set the array pointer and instance count into each model */
model->BSIM3InstCount = InstCount;
model->BSIM3InstanceArray = InstArray;
}
#endif

10
src/spicelib/devices/bsim3v32/b3v32dest.c

@ -19,11 +19,6 @@ BSIM3v32destroy (GENmodel **inModel)
{
BSIM3v32model *mod = *(BSIM3v32model**) inModel;
#ifdef USE_OMP
/* free just once for all models */
FREE(mod->BSIM3v32InstanceArray);
#endif
while (mod) {
BSIM3v32model *next_mod = mod->BSIM3v32nextModel;
BSIM3v32instance *inst = mod->BSIM3v32instances;
@ -40,6 +35,11 @@ BSIM3v32destroy (GENmodel **inModel)
FREE(inst);
inst = next_inst;
}
#ifdef USE_OMP
FREE(mod->BSIM3v32InstanceArray);
#endif
FREE(mod->BSIM3v32version);
FREE(mod);
mod = next_mod;

8
src/spicelib/devices/bsim3v32/b3v32set.c

@ -1149,9 +1149,14 @@ do { if((here->ptr = SMPmakeElt(matrix, here->first, here->second)) == NULL){\
{
InstCount++;
}
model->BSIM3v32InstCount = 0;
model->BSIM3v32InstanceArray = NULL;
}
InstArray = TMALLOC(BSIM3v32instance*, InstCount);
model = (BSIM3v32model*)inModel;
/* store this in the first model only */
model->BSIM3v32InstCount = InstCount;
model->BSIM3v32InstanceArray = InstArray;
idx = 0;
for (; model != NULL; model = model->BSIM3v32nextModel)
{
@ -1162,9 +1167,6 @@ do { if((here->ptr = SMPmakeElt(matrix, here->first, here->second)) == NULL){\
InstArray[idx] = here;
idx++;
}
/* set the array pointer and instance count into each model */
model->BSIM3v32InstCount = InstCount;
model->BSIM3v32InstanceArray = InstArray;
}
#endif

10
src/spicelib/devices/bsim4/b4dest.c

@ -68,11 +68,6 @@ BSIM4destroy(GENmodel **inModel)
{
BSIM4model *mod = *(BSIM4model**) inModel;
#ifdef USE_OMP
/* free just once for all models */
FREE(mod->BSIM4InstanceArray);
#endif
while (mod) {
BSIM4model *next_mod = mod->BSIM4nextModel;
BSIM4instance *inst = mod->BSIM4instances;
@ -89,6 +84,11 @@ BSIM4destroy(GENmodel **inModel)
FREE(inst);
inst = next_inst;
}
#ifdef USE_OMP
FREE(mod->BSIM4InstanceArray);
#endif
FREE(mod->BSIM4version);
FREE(mod);
mod = next_mod;

8
src/spicelib/devices/bsim4/b4set.c

@ -2728,9 +2728,14 @@ do { if((here->ptr = SMPmakeElt(matrix,here->first,here->second))==(double *)NUL
{
InstCount++;
}
model->BSIM4InstCount = 0;
model->BSIM4InstanceArray = NULL;
}
InstArray = TMALLOC(BSIM4instance*, InstCount);
model = (BSIM4model*)inModel;
/* store this in the first model only */
model->BSIM4InstCount = InstCount;
model->BSIM4InstanceArray = InstArray;
idx = 0;
for( ; model != NULL; model = model->BSIM4nextModel )
{
@ -2741,9 +2746,6 @@ do { if((here->ptr = SMPmakeElt(matrix,here->first,here->second))==(double *)NUL
InstArray[idx] = here;
idx++;
}
/* set the array pointer and instance count into each model */
model->BSIM4InstCount = InstCount;
model->BSIM4InstanceArray = InstArray;
}
#endif

10
src/spicelib/devices/bsim4v5/b4v5dest.c

@ -18,11 +18,6 @@ BSIM4v5destroy(GENmodel **inModel)
{
BSIM4v5model *mod = *(BSIM4v5model**) inModel;
#ifdef USE_OMP
/* free just once for all models */
FREE(mod->BSIM4v5InstanceArray);
#endif
while (mod) {
BSIM4v5model *next_mod = mod->BSIM4v5nextModel;
BSIM4v5instance *inst = mod->BSIM4v5instances;
@ -39,6 +34,11 @@ BSIM4v5destroy(GENmodel **inModel)
FREE(inst);
inst = next_inst;
}
#ifdef USE_OMP
FREE(mod->BSIM4v5InstanceArray);
#endif
FREE(mod->BSIM4v5version);
FREE(mod);
mod = next_mod;

8
src/spicelib/devices/bsim4v5/b4v5set.c

@ -2106,9 +2106,14 @@ do { if((here->ptr = SMPmakeElt(matrix, here->first, here->second)) == NULL){\
{
InstCount++;
}
model->BSIM4v5InstCount = 0;
model->BSIM4v5InstanceArray = NULL;
}
InstArray = TMALLOC(BSIM4v5instance*, InstCount);
model = (BSIM4v5model*)inModel;
/* store this in the first model only */
model->BSIM4v5InstCount = InstCount;
model->BSIM4v5InstanceArray = InstArray;
idx = 0;
for (; model != NULL; model = model->BSIM4v5nextModel)
{
@ -2119,9 +2124,6 @@ do { if((here->ptr = SMPmakeElt(matrix, here->first, here->second)) == NULL){\
InstArray[idx] = here;
idx++;
}
/* set the array pointer and instance count into each model */
model->BSIM4v5InstCount = InstCount;
model->BSIM4v5InstanceArray = InstArray;
}
#endif

10
src/spicelib/devices/bsim4v6/b4v6dest.c

@ -20,11 +20,6 @@ BSIM4v6destroy(GENmodel **inModel)
{
BSIM4v6model *mod = *(BSIM4v6model**) inModel;
#ifdef USE_OMP
/* free just once for all models */
FREE(mod->BSIM4v6InstanceArray);
#endif
while (mod) {
BSIM4v6model *next_mod = mod->BSIM4v6nextModel;
BSIM4v6instance *inst = mod->BSIM4v6instances;
@ -41,6 +36,11 @@ BSIM4v6destroy(GENmodel **inModel)
FREE(inst);
inst = next_inst;
}
#ifdef USE_OMP
FREE(mod->BSIM4v6InstanceArray);
#endif
FREE(mod->BSIM4v6version);
FREE(mod);
mod = next_mod;

8
src/spicelib/devices/bsim4v6/b4v6set.c

@ -2441,9 +2441,14 @@ do { if((here->ptr = SMPmakeElt(matrix, here->first, here->second)) == NULL){\
{
InstCount++;
}
model->BSIM4v6InstCount = 0;
model->BSIM4v6InstanceArray = NULL;
}
InstArray = TMALLOC(BSIM4v6instance*, InstCount);
model = (BSIM4v6model*)inModel;
/* store this in the first model only */
model->BSIM4v6InstCount = InstCount;
model->BSIM4v6InstanceArray = InstArray;
idx = 0;
for( ; model != NULL; model = model->BSIM4v6nextModel )
{
@ -2454,9 +2459,6 @@ do { if((here->ptr = SMPmakeElt(matrix, here->first, here->second)) == NULL){\
InstArray[idx] = here;
idx++;
}
/* set the array pointer and instance count into each model */
model->BSIM4v6InstCount = InstCount;
model->BSIM4v6InstanceArray = InstArray;
}
#endif

10
src/spicelib/devices/bsim4v7/b4v7dest.c

@ -20,11 +20,6 @@ BSIM4v7destroy(GENmodel **inModel)
{
BSIM4v7model *mod = *(BSIM4v7model**) inModel;
#ifdef USE_OMP
/* free just once for all models */
FREE(mod->BSIM4v7InstanceArray);
#endif
while (mod) {
BSIM4v7model *next_mod = mod->BSIM4v7nextModel;
BSIM4v7instance *inst = mod->BSIM4v7instances;
@ -41,6 +36,11 @@ BSIM4v7destroy(GENmodel **inModel)
FREE(inst);
inst = next_inst;
}
#ifdef USE_OMP
FREE(mod->BSIM4v7InstanceArray);
#endif
/* mod->BSIM4v7modName to be freed in INPtabEnd() */
FREE(mod->BSIM4v7version);
FREE(mod);

8
src/spicelib/devices/bsim4v7/b4v7set.c

@ -2596,9 +2596,14 @@ do { if((here->ptr = SMPmakeElt(matrix,here->first,here->second))==(double *)NUL
{
InstCount++;
}
model->BSIM4v7InstCount = 0;
model->BSIM4v7InstanceArray = NULL;
}
InstArray = TMALLOC(BSIM4v7instance*, InstCount);
model = (BSIM4v7model*)inModel;
/* store this in the first model only */
model->BSIM4v7InstCount = InstCount;
model->BSIM4v7InstanceArray = InstArray;
idx = 0;
for( ; model != NULL; model = model->BSIM4v7nextModel )
{
@ -2609,9 +2614,6 @@ do { if((here->ptr = SMPmakeElt(matrix,here->first,here->second))==(double *)NUL
InstArray[idx] = here;
idx++;
}
/* set the array pointer and instance count into each model */
model->BSIM4v7InstCount = InstCount;
model->BSIM4v7InstanceArray = InstArray;
}
#endif

10
src/spicelib/devices/bsimsoi/b4soidest.c

@ -24,11 +24,6 @@ B4SOIdestroy(GENmodel **inModel)
{
B4SOImodel *mod = *(B4SOImodel**) inModel;
#ifdef USE_OMP
/* free just once for all models */
FREE(mod->B4SOIInstanceArray);
#endif
while (mod) {
B4SOImodel *next_mod = mod->B4SOInextModel;
B4SOIinstance *inst = mod->B4SOIinstances;
@ -37,6 +32,11 @@ B4SOIdestroy(GENmodel **inModel)
FREE(inst);
inst = next_inst;
}
#ifdef USE_OMP
FREE(mod->B4SOIInstanceArray);
#endif
FREE(mod);
mod = next_mod;
}

8
src/spicelib/devices/bsimsoi/b4soiset.c

@ -2733,9 +2733,14 @@ do { if((here->ptr = SMPmakeElt(matrix,here->first,here->second))==(double *)NUL
{
InstCount++;
}
model->B4SOIInstCount = 0;
model->B4SOIInstanceArray = NULL;
}
InstArray = TMALLOC(B4SOIinstance*, InstCount);
model = (B4SOImodel*)inModel;
/* store this in the first model only */
model->B4SOIInstCount = InstCount;
model->B4SOIInstanceArray = InstArray;
idx = 0;
for( ; model != NULL; model = model->B4SOInextModel )
{
@ -2746,9 +2751,6 @@ do { if((here->ptr = SMPmakeElt(matrix,here->first,here->second))==(double *)NUL
InstArray[idx] = here;
idx++;
}
/* set the array pointer and instance count into each model */
model->B4SOIInstCount = InstCount;
model->B4SOIInstanceArray = InstArray;
}
#endif

10
src/spicelib/devices/hisim2/hsm2dest.c

@ -64,11 +64,6 @@ 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;
@ -77,6 +72,11 @@ HSM2destroy(GENmodel **inModel)
FREE(inst);
inst = next_inst;
}
#ifdef USE_OMP
FREE(mod->HSM2InstanceArray);
#endif
FREE(mod);
mod = next_mod;
}

8
src/spicelib/devices/hisim2/hsm2set.c

@ -1275,9 +1275,14 @@ do { if((here->ptr = SMPmakeElt(matrix,here->first,here->second))==(double *)NUL
{
InstCount++;
}
model->HSM2InstCount = 0;
model->HSM2InstanceArray = NULL;
}
InstArray = TMALLOC(HSM2instance*, InstCount);
model = (HSM2model*)inModel;
/* store this in the first model only */
model->HSM2InstCount = InstCount;
model->HSM2InstanceArray = InstArray;
idx = 0;
for ( ; model != NULL; model = model->HSM2nextModel )
{
@ -1288,9 +1293,6 @@ do { if((here->ptr = SMPmakeElt(matrix,here->first,here->second))==(double *)NUL
InstArray[idx] = here;
idx++;
}
/* set the array pointer and instance count into each model */
model->HSM2InstCount = InstCount;
model->HSM2InstanceArray = InstArray;
}
#endif

Loading…
Cancel
Save