diff --git a/src/frontend/spiceif.c b/src/frontend/spiceif.c index 2165cf623..268f70084 100644 --- a/src/frontend/spiceif.c +++ b/src/frontend/spiceif.c @@ -616,8 +616,7 @@ finddev_special( // assert(third && *third == NULL); for all invocations *devptr = ft_sim->findInstance (ckt, &type, devptr, name); - err = *devptr ? OK : E_NODEV; - if (err == OK) { + if (*devptr) { *device_or_model = 0; return (type); } @@ -1219,8 +1218,7 @@ finddev(CKTcircuit *ckt, char *name, GENinstance **devptr, GENmodel **modptr) // assert(third && *third == NULL); for all invocations *devptr = ft_sim->findInstance (ckt, &type, devptr, name); - err = *devptr ? OK : E_NODEV; - if (err == OK) + if (*devptr) return (type); type = -1; diff --git a/src/spicelib/analysis/noisean.c b/src/spicelib/analysis/noisean.c index f6af9d779..d6228a890 100644 --- a/src/spicelib/analysis/noisean.c +++ b/src/spicelib/analysis/noisean.c @@ -50,8 +50,7 @@ NOISEan (CKTcircuit *ckt, int restart) if (code != -1) { // assert(third && *third == NULL); inst = CKTfndDev(ckt, NULL, &inst, job->input); - error = inst ? OK : E_NODEV; - if (!error && !((VSRCinstance *)inst)->VSRCacGiven) { + if (inst && !((VSRCinstance *)inst)->VSRCacGiven) { errMsg = TMALLOC(char, strlen(noacinput) + 1); strcpy(errMsg,noacinput); return (E_NOACINPUT); @@ -62,8 +61,7 @@ NOISEan (CKTcircuit *ckt, int restart) if (code != -1 && inst==NULL) { // assert(third && *third == NULL); inst = CKTfndDev(ckt, NULL, &inst, job->input); - error = inst ? OK : E_NODEV; - if (error) { + if (!inst) { /* XXX ??? */ SPfrontEnd->IFerror (ERR_WARNING, "Noise input source %s not in circuit", diff --git a/src/spicelib/analysis/tfanal.c b/src/spicelib/analysis/tfanal.c index 810bd1f05..c5ab89075 100644 --- a/src/spicelib/analysis/tfanal.c +++ b/src/spicelib/analysis/tfanal.c @@ -53,8 +53,7 @@ TFanal(CKTcircuit *ckt, int restart) if(Itype != -1) { // assert(third && *third == NULL); ptr = CKTfndDev(ckt, NULL, &ptr, job->TFinSrc); - error = ptr ? OK : E_NODEV; - if(error ==0) { + if (ptr) { job->TFinIsI = 1; job->TFinIsV = 0; } else { @@ -65,10 +64,9 @@ TFanal(CKTcircuit *ckt, int restart) if( (Vtype != -1) && (ptr==NULL) ) { // assert(third && *third == NULL); ptr = CKTfndDev(ckt, NULL, &ptr, job->TFinSrc); - error = ptr ? OK : E_NODEV; job->TFinIsV = 1; job->TFinIsI = 0; - if(error !=0) { + if (!ptr) { SPfrontEnd->IFerror (ERR_WARNING, "Transfer function source %s not in circuit", &(job->TFinSrc)); diff --git a/src/spicelib/devices/cktcrte.c b/src/spicelib/devices/cktcrte.c index 8ececf179..c72e78c72 100644 --- a/src/spicelib/devices/cktcrte.c +++ b/src/spicelib/devices/cktcrte.c @@ -21,7 +21,6 @@ CKTcrtElt(CKTcircuit *ckt, GENmodel *modPtr, GENinstance **inInstPtr, IFuid name GENinstance *instPtr = NULL; /* instPtr points to the data struct for per-instance data */ SPICEdev **DEVices; - int error; int type; DEVices = devices(); @@ -31,9 +30,8 @@ CKTcrtElt(CKTcircuit *ckt, GENmodel *modPtr, GENinstance **inInstPtr, IFuid name // assert(third && *third == NULL); instPtr = CKTfndDev(ckt, NULL, &instPtr, name); - error = instPtr ? OK : E_NODEV; - if (error == OK) { + if (instPtr) { if (inInstPtr) *inInstPtr = instPtr; return E_EXISTS; diff --git a/src/spicelib/devices/ind/mutsetup.c b/src/spicelib/devices/ind/mutsetup.c index 3d26d2147..0379e4061 100644 --- a/src/spicelib/devices/ind/mutsetup.c +++ b/src/spicelib/devices/ind/mutsetup.c @@ -24,7 +24,6 @@ MUTsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states) MUTmodel *model = (MUTmodel*)inModel; MUTinstance *here; int ktype; - int error; NG_IGNORE(states); @@ -45,8 +44,7 @@ MUTsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states) // assert(third); here->MUTind1 = (INDinstance *) CKTfndDev(ckt, NULL, (GENinstance **) &(here->MUTind1), here->MUTindName1); - error = here->MUTind1 ? OK : E_NODEV; - if(error) { + if (!here->MUTind1) { IFuid namarray[2]; namarray[0]=here->MUTname; namarray[1]=here->MUTindName1; @@ -56,8 +54,7 @@ MUTsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states) } // assert(third); here->MUTind2 = (INDinstance *) CKTfndDev(ckt, NULL, (GENinstance **) &(here->MUTind2), here->MUTindName2); - error = here->MUTind2 ? OK : E_NODEV; - if(error) { + if (!here->MUTind2) { IFuid namarray[2]; namarray[0]=here->MUTname; namarray[1]=here->MUTindName2; diff --git a/src/spicelib/parser/inpaname.c b/src/spicelib/parser/inpaname.c index 7e85cfa21..97d18fa0d 100644 --- a/src/spicelib/parser/inpaname.c +++ b/src/spicelib/parser/inpaname.c @@ -42,9 +42,8 @@ INPaName(char *parm, IFvalue * val, CKTcircuit *ckt, int *dev, char *devnam, */ // assert(third) for all invocations *fast = sim->findInstance (ckt, dev, fast, devnam); - error = *fast ? OK : E_NODEV; - if (error) - return (error); + if (*fast == NULL) + return (E_NODEV); /* now find the parameter - hunt through the parameter tables for * this device type and look for a name match of an 'ask'able diff --git a/src/tclspice.c b/src/tclspice.c index f6a514780..377b11156 100644 --- a/src/tclspice.c +++ b/src/tclspice.c @@ -1396,11 +1396,12 @@ get_mod_param TCL_CMDPROCARGS(clientData, interp, argc, argv) INPretrieve(&name, ft_curckt->ci_symtab); // assert(third && *third == NULL); devptr = ft_sim->findInstance (ft_curckt->ci_ckt, &typecode, &devptr, name); - err = devptr ? OK : E_NODEV; - if (err != OK) { + if (!devptr) { typecode = -1; devptr = NULL; err = ft_sim->findModel (ft_curckt->ci_ckt, &typecode, &modptr, name); + } else { + err = OK; } if (err != OK) { sprintf(buf, "No such device or model name %s", name); diff --git a/src/unsupported/snstart.c b/src/unsupported/snstart.c index 753fa83cb..70f7d7813 100644 --- a/src/unsupported/snstart.c +++ b/src/unsupported/snstart.c @@ -44,9 +44,8 @@ SENstartup(CKTcircuit *ckt, int restart) // assert(third && *third == NULL); fast = CKTfndDev(ckt, &type, &fast, ckt->CKTsenInfo->SENdevices[i]); - err = fast ? OK : E_NODEV; - if (err != OK) - return err; + if (!fast) + return E_NODEV; #ifdef SENSDEBUG printf("SENstartup Instance: %s Design parameter: %s\n", ckt->CKTsenInfo->SENdevices[i],