CKTfndDev(), #5/6, cleanup
This commit is contained in:
parent
235283d96a
commit
a2b50f5c1e
|
|
@ -27,15 +27,15 @@ CKTfndDev(CKTcircuit *ckt, int *type, GENinstance **fast, IFuid name, GENmodel *
|
|||
GENinstance *here;
|
||||
GENmodel *mods;
|
||||
|
||||
/* we know the device instance `fast' */
|
||||
if (fast && *fast) {
|
||||
/* already have fast, so nothing much to do just get & set type */
|
||||
if (type)
|
||||
*type = (*fast)->GENmodPtr->GENmodType;
|
||||
return OK;
|
||||
}
|
||||
|
||||
/* we know the model `modfast', but need to find the device instance */
|
||||
if (modfast) {
|
||||
/* have model, just need device */
|
||||
mods = modfast;
|
||||
here = find_instance(mods->GENinstances, name);
|
||||
if (here) {
|
||||
|
|
@ -50,8 +50,8 @@ CKTfndDev(CKTcircuit *ckt, int *type, GENinstance **fast, IFuid name, GENmodel *
|
|||
return E_NODEV;
|
||||
}
|
||||
|
||||
/* we know device `type', but need to find model and device instance */
|
||||
if (*type >= 0 && *type < DEVmaxnum) {
|
||||
/* have device type, need to find model & device */
|
||||
/* look through all models */
|
||||
for (mods = ckt->CKThead[*type]; mods ; mods = mods->GENnextModel) {
|
||||
/* and all instances */
|
||||
|
|
@ -69,10 +69,9 @@ CKTfndDev(CKTcircuit *ckt, int *type, GENinstance **fast, IFuid name, GENmodel *
|
|||
return E_NOMOD;
|
||||
}
|
||||
|
||||
/* we don't even know `type', search all of them */
|
||||
if (*type == -1) {
|
||||
/* look through all types (UGH - worst case - take forever) */
|
||||
for (*type = 0; *type < DEVmaxnum; (*type)++) {
|
||||
/* need to find model & device */
|
||||
/* look through all models */
|
||||
for (mods = ckt->CKThead[*type]; mods; mods = mods->GENnextModel) {
|
||||
/* and all instances */
|
||||
|
|
|
|||
Loading…
Reference in New Issue