rewrite-rw, TSTALLOC()

This commit is contained in:
rlar 2018-03-06 21:30:00 +01:00
parent d1acfdc738
commit 97d61c495f
2 changed files with 12 additions and 12 deletions

View File

@ -11,6 +11,12 @@ Author: 1985 Gordon Jacobs
#include "ngspice/sperror.h"
#include "ngspice/suffix.h"
#define TSTALLOC(ptr, first, second) \
do { \
if (!(here->ptr = SMPmakeElt(matrix, here->first, here->second))) \
return E_NOMEM; \
} while(0)
int
CSWsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states)
@ -53,12 +59,6 @@ CSWsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states)
return E_BADPARM;
}
/* macro to make elements with built in test for out of memory */
#define TSTALLOC(ptr,first,second) \
do { if((here->ptr = SMPmakeElt(matrix, here->first, here->second)) == NULL){\
return(E_NOMEM);\
} } while(0)
TSTALLOC(CSWposPosPtr, CSWposNode, CSWposNode);
TSTALLOC(CSWposNegPtr, CSWposNode, CSWnegNode);
TSTALLOC(CSWnegPosPtr, CSWnegNode, CSWposNode);

View File

@ -12,6 +12,12 @@ Author: 1985 Gordon Jacobs
#include "ngspice/sperror.h"
#include "ngspice/suffix.h"
#define TSTALLOC(ptr, first, second) \
do { \
if (!(here->ptr = SMPmakeElt(matrix, here->first, here->second))) \
return E_NOMEM; \
} while (0)
int
SWsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states)
@ -48,12 +54,6 @@ SWsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states)
/* Default Value Processing for Switch Instance */
/* none */
/* macro to make elements with built in test for out of memory */
#define TSTALLOC(ptr,first,second) \
do { if((here->ptr = SMPmakeElt(matrix, here->first, here->second)) == NULL){\
return(E_NOMEM);\
} } while(0)
TSTALLOC(SWposPosPtr, SWposNode, SWposNode);
TSTALLOC(SWposNegPtr, SWposNode, SWnegNode);
TSTALLOC(SWnegPosPtr, SWnegNode, SWposNode);