Browse Source

CKThead structure now allocated dynamically.

pre-master-46
pnenzi 25 years ago
parent
commit
c099f63794
  1. 18
      src/include/cktdefs.h
  2. 10
      src/spicelib/devices/cktinit.c

18
src/include/cktdefs.h

@ -49,7 +49,23 @@ typedef struct sCKTnode {
typedef struct {
GENmodel *CKThead[MAXNUMDEVS]; /* The max number of loadable devices */
/* gtri - begin - wbk - change declaration to allow dynamic sizing */
/* An associated change is made in CKTinit.c to alloc the space */
/* required for the pointers. No changes are needed to the source */
/* code at the 3C1 level, although the compiler will generate */
/* slightly different code for references to this data. */
/* GENmodel *CKThead[MAXNUMDEVS]; The max number of loadable devices */
GENmodel **CKThead;
/* gtri - end - wbk - change declaration to allow dynamic sizing */
/* GENmodel *CKThead[MAXNUMDEVS]; maschmann : deleted */
STATistics *CKTstat; /* The STATistics structure */
double *(CKTstates[8]); /* Used as memory of past steps ??? */

10
src/spicelib/devices/cktinit.c

@ -22,6 +22,16 @@ CKTinit(void **ckt) /* new circuit to create */
sckt = (CKTcircuit *)(*ckt);
if (sckt == NULL)
return(E_NOMEM);
/* gtri - begin - dynamically allocate the array of model lists */
/* CKThead used to be statically sized in CKTdefs.h, but has been changed */
/* to a ** pointer */
(sckt)->CKThead = (GENmodel **)MALLOC(DEVmaxnum * sizeof(GENmodel *));
if((sckt)->CKThead == NULL) return(E_NOMEM);
/* gtri - end - dynamically allocate the array of model lists */
for (i = 0; i < DEVmaxnum; i++)
sckt->CKThead[i] = (GENmodel *) NULL;

Loading…
Cancel
Save