CKThead structure now allocated dynamically.

This commit is contained in:
pnenzi 2001-05-05 09:54:41 +00:00
parent e96628b7bd
commit c099f63794
2 changed files with 27 additions and 1 deletions

View File

@ -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 ??? */

View File

@ -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;