Excape from doubly nested loop quickly for efficiency

This commit is contained in:
Mark Pizzolato 2013-02-04 13:55:09 -08:00
parent 7bd01a5873
commit d65b12da84

View file

@ -571,9 +571,13 @@ if (name) { /* updating? */
return SCPE_ARG; return SCPE_ARG;
for (autp = auto_tab; autp->numc >= 0; autp++) { for (autp = auto_tab; autp->numc >= 0; autp++) {
for (j = 0; (j < AUTO_MAXC) && autp->dnam[j]; j++) { for (j = 0; (j < AUTO_MAXC) && autp->dnam[j]; j++) {
if (strcmp (name, autp->dnam[j]) == 0) if (strcmp (name, autp->dnam[j]) == 0) {
autp->numc = nctrl; autp->numc = nctrl;
break;
}
} }
if ((j < AUTO_MAXC) && autp->dnam[j] && (strcmp (name, autp->dnam[j]) == 0))
break;
} }
} }
for (autp = auto_tab; autp->numc >= 0; autp++) { /* loop thru table */ for (autp = auto_tab; autp->numc >= 0; autp++) { /* loop thru table */