diff --git a/src/spicelib/analysis/ckti2nod.c b/src/spicelib/analysis/ckti2nod.c index 4c3e0971f..edf730566 100644 --- a/src/spicelib/analysis/ckti2nod.c +++ b/src/spicelib/analysis/ckti2nod.c @@ -2,13 +2,6 @@ Copyright 1990 Regents of the University of California. All rights reserved. Author: 1985 Thomas L. Quarles **********/ -/* - */ - - /* CKTinst2Node - * get the name and node pointer for a node given a device it is - * bound to and the terminal of the device. - */ #include "ngspice/ngspice.h" #include "ngspice/ifsim.h" @@ -18,30 +11,32 @@ Author: 1985 Thomas L. Quarles #include "ngspice/devdefs.h" +/* CKTinst2Node + * get the name and node pointer for a node given a device it is + * bound to and the terminal of the device. + */ int CKTinst2Node(CKTcircuit *ckt, void *instPtr, int terminal, CKTnode **node, IFuid *nodeName) { - int nodenum; - int type; + GENinstance *inst = (GENinstance *) instPtr; + int type = inst->GENmodPtr->GENmodType; + CKTnode *here; - type = ((GENinstance *)instPtr)->GENmodPtr->GENmodType; - - if(*(DEVices[type]->DEVpublic.terms) >= terminal && terminal > 0) { + if (*(DEVices[type]->DEVpublic.terms) >= terminal && terminal > 0) { /* argh, terminals are counted from 1 */ - nodenum = ((GENinstance *)instPtr)->GENnode[terminal - 1]; - /* ok, now we know its number, so we just have to find it.*/ - for(here = ckt->CKTnodes;here;here = here->next) { - if(here->number == nodenum) { - /* found it */ + int nodenum = inst->GENnode[terminal - 1]; + + for (here = ckt->CKTnodes; here; here = here->next) + if (here->number == nodenum) { *node = here; *nodeName = here->name; - return(OK); + return OK; } - } - return(E_NOTFOUND); + + return E_NOTFOUND; } else { - return(E_NOTERM); + return E_NOTERM; } } diff --git a/src/spicelib/devices/cktbindnode.c b/src/spicelib/devices/cktbindnode.c index e1232c93c..62f7e225f 100644 --- a/src/spicelib/devices/cktbindnode.c +++ b/src/spicelib/devices/cktbindnode.c @@ -15,21 +15,18 @@ Author: 1985 Thomas L. Quarles #include "dev.h" + int CKTbindNode(CKTcircuit *ckt, GENinstance *instance, int term, CKTnode *node) { - int mappednode; - SPICEdev **devs; + SPICEdev **devs = devices(); int type = instance->GENmodPtr->GENmodType; NG_IGNORE(ckt); - devs = devices(); - mappednode = node->number; - if (*(devs[type]->DEVpublic.terms) >= term && term > 0) { /* argh, terminals are counted from 1 */ - instance->GENnode[term - 1] = mappednode; + instance->GENnode[term - 1] = node->number; return OK; } else { return E_NOTERM;