CKTfndDev(), express error return value outside of this function

if (fast != NULL) then
     err = CKTfndDev(,, fast, );
is equivalent to
     err = CKTfndDev(,, fast, );
     err = *fast ? OK : E_NODEV;
This commit is contained in:
rlar 2013-07-17 20:27:16 +02:00
parent 6e7d70e4bb
commit 7bacfc73d1
8 changed files with 12 additions and 0 deletions

View File

@ -616,6 +616,7 @@ finddev_special(
// assert(third && *third == NULL); for all invocations
err = ft_sim->findInstance (ckt, &type, devptr, name);
err = *devptr ? OK : E_NODEV;
if (err == OK) {
*device_or_model = 0;
return (type);
@ -1218,6 +1219,7 @@ finddev(CKTcircuit *ckt, char *name, GENinstance **devptr, GENmodel **modptr)
// assert(third && *third == NULL); for all invocations
err = ft_sim->findInstance (ckt, &type, devptr, name);
err = *devptr ? OK : E_NODEV;
if (err == OK)
return (type);

View File

@ -50,6 +50,7 @@ NOISEan (CKTcircuit *ckt, int restart)
if (code != -1) {
// assert(third && *third == NULL);
error = CKTfndDev(ckt, NULL, &inst, job->input);
error = inst ? OK : E_NODEV;
if (!error && !((VSRCinstance *)inst)->VSRCacGiven) {
errMsg = TMALLOC(char, strlen(noacinput) + 1);
strcpy(errMsg,noacinput);
@ -61,6 +62,7 @@ NOISEan (CKTcircuit *ckt, int restart)
if (code != -1 && inst==NULL) {
// assert(third && *third == NULL);
error = CKTfndDev(ckt, NULL, &inst, job->input);
error = inst ? OK : E_NODEV;
if (error) {
/* XXX ??? */
SPfrontEnd->IFerror (ERR_WARNING,

View File

@ -53,6 +53,7 @@ TFanal(CKTcircuit *ckt, int restart)
if(Itype != -1) {
// assert(third && *third == NULL);
error = CKTfndDev(ckt, NULL, &ptr, job->TFinSrc);
error = ptr ? OK : E_NODEV;
if(error ==0) {
job->TFinIsI = 1;
job->TFinIsV = 0;
@ -64,6 +65,7 @@ TFanal(CKTcircuit *ckt, int restart)
if( (Vtype != -1) && (ptr==NULL) ) {
// assert(third && *third == NULL);
error = CKTfndDev(ckt, NULL, &ptr, job->TFinSrc);
error = ptr ? OK : E_NODEV;
job->TFinIsV = 1;
job->TFinIsI = 0;
if(error !=0) {

View File

@ -31,6 +31,7 @@ CKTcrtElt(CKTcircuit *ckt, GENmodel *modPtr, GENinstance **inInstPtr, IFuid name
// assert(third && *third == NULL);
error = CKTfndDev(ckt, NULL, &instPtr, name);
error = instPtr ? OK : E_NODEV;
if (error == OK) {
if (inInstPtr)

View File

@ -45,6 +45,7 @@ MUTsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states)
// assert(third);
error = CKTfndDev(ckt, NULL, (GENinstance **) &(here->MUTind1), here->MUTindName1);
error = here->MUTind1 ? OK : E_NODEV;
if(error) {
IFuid namarray[2];
namarray[0]=here->MUTname;
@ -55,6 +56,7 @@ MUTsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states)
}
// assert(third);
error = CKTfndDev(ckt, NULL, (GENinstance **) &(here->MUTind2), here->MUTindName2);
error = here->MUTind2 ? OK : E_NODEV;
if(error) {
IFuid namarray[2];
namarray[0]=here->MUTname;

View File

@ -42,6 +42,7 @@ INPaName(char *parm, IFvalue * val, CKTcircuit *ckt, int *dev, char *devnam,
*/
// assert(third) for all invocations
error = sim->findInstance (ckt, dev, fast, devnam);
error = *fast ? OK : E_NODEV;
if (error)
return (error);

View File

@ -1396,6 +1396,7 @@ get_mod_param TCL_CMDPROCARGS(clientData, interp, argc, argv)
INPretrieve(&name, ft_curckt->ci_symtab);
// assert(third && *third == NULL);
err = ft_sim->findInstance (ft_curckt->ci_ckt, &typecode, &devptr, name);
err = devptr ? OK : E_NODEV;
if (err != OK) {
typecode = -1;
devptr = NULL;

View File

@ -44,6 +44,7 @@ SENstartup(CKTcircuit *ckt, int restart)
// assert(third && *third == NULL);
err = CKTfndDev(ckt, &type, &fast, ckt->CKTsenInfo->SENdevices[i]);
err = fast ? OK : E_NODEV;
if (err != OK)
return err;