Browse Source

Add a correction to the previous change of inppas4.c, which freed devname and left instance name pointers in DEVnameHash pointing at freed memory. This commit adds the devname string to the symbol tables which are eventually cleared by INPtabEnd. Also, if a capacitor in the spice netlist has the same name (unlikely, but possible) as a shunt capacitor, then no shunt is created, and a warning is issued.

pre-master-46
Brian Taylor 6 months ago
committed by Holger Vogt
parent
commit
4f5c23ba44
  1. 20
      src/spicelib/parser/inppas4.c

20
src/spicelib/parser/inppas4.c

@ -57,8 +57,24 @@ void INPpas4(CKTcircuit *ckt, INPtables *tab)
int nn = node->number; int nn = node->number;
char* devname = tprintf("capac%dshunt", nn); char* devname = tprintf("capac%dshunt", nn);
(*(ft_sim->newInstance))(ckt, tab->defCmod, &fast, devname);
txfree(devname);
fast = (*(ft_sim->findInstance))(ckt, devname);
if (fast) {
fprintf(stderr,
"WARNING: non-cshunt instance %s already exists\n",
devname);
tfree(devname);
continue;
}
error = (*(ft_sim->newInstance))(ckt, tab->defCmod, &fast, devname);
if (error) {
fprintf(stderr,
"ERROR: cshunt newInstance status %d devname %s\n",
error, devname);
tfree(devname);
continue;
}
/* devname is eventually freed when INPtabEnd is called */
INPinsert(&devname, tab);
/* the top node, second node is gnd automatically */ /* the top node, second node is gnd automatically */
(*(ft_sim->bindNode))(ckt, fast, 1, node); (*(ft_sim->bindNode))(ckt, fast, 1, node);

Loading…
Cancel
Save