Browse Source

CKTfndDev(), #3/6, cleanup

pre-master-46
rlar 13 years ago
parent
commit
52c0731b69
  1. 18
      src/spicelib/devices/cktfinddev.c

18
src/spicelib/devices/cktfinddev.c

@ -27,8 +27,8 @@ CKTfndDev(CKTcircuit *ckt, int *type, GENinstance **fast, IFuid name, GENmodel *
GENinstance *here; GENinstance *here;
GENmodel *mods; GENmodel *mods;
if (fast != NULL &&
*fast != NULL)
if (fast &&
*fast)
{ {
/* already have fast, so nothing much to do just get & set type */ /* already have fast, so nothing much to do just get & set type */
if (type) if (type)
@ -41,7 +41,7 @@ CKTfndDev(CKTcircuit *ckt, int *type, GENinstance **fast, IFuid name, GENmodel *
mods = modfast; mods = modfast;
here = find_instance(mods->GENinstances, name); here = find_instance(mods->GENinstances, name);
if (here) { if (here) {
if (fast != NULL)
if (fast)
*fast = here; *fast = here;
if (type) if (type)
@ -56,14 +56,14 @@ CKTfndDev(CKTcircuit *ckt, int *type, GENinstance **fast, IFuid name, GENmodel *
/* have device type, need to find model & device */ /* have device type, need to find model & device */
/* look through all models */ /* look through all models */
for (mods = ckt->CKThead[*type]; for (mods = ckt->CKThead[*type];
mods != NULL ;
mods ;
mods = mods->GENnextModel) mods = mods->GENnextModel)
{ {
/* and all instances */ /* and all instances */
if (modname == NULL || mods->GENmodName == modname) {
if (!modname || mods->GENmodName == modname) {
here = find_instance(mods->GENinstances, name); here = find_instance(mods->GENinstances, name);
if (here) { if (here) {
if (fast != 0)
if (fast)
*fast = here; *fast = here;
return OK; return OK;
} }
@ -77,14 +77,14 @@ CKTfndDev(CKTcircuit *ckt, int *type, GENinstance **fast, IFuid name, GENmodel *
for (*type = 0; *type < DEVmaxnum; (*type)++) { for (*type = 0; *type < DEVmaxnum; (*type)++) {
/* need to find model & device */ /* need to find model & device */
/* look through all models */ /* look through all models */
for (mods = ckt->CKThead[*type]; mods != NULL;
for (mods = ckt->CKThead[*type]; mods;
mods = mods->GENnextModel) mods = mods->GENnextModel)
{ {
/* and all instances */ /* and all instances */
if (modname == NULL || mods->GENmodName == modname) {
if (!modname || mods->GENmodName == modname) {
here = find_instance(mods->GENinstances, name); here = find_instance(mods->GENinstances, name);
if (here) { if (here) {
if (fast != 0)
if (fast)
*fast = here; *fast = here;
return OK; return OK;
} }

Loading…
Cancel
Save