1
0
mirror of https://github.com/ericonr/sndio.git synced 2024-02-18 04:45:21 -06:00

Swap "if" and "else" code blocks in slot_new() to improve readability.

No behavior change.
This commit is contained in:
Alexandre Ratchov 2019-07-10 11:43:45 +02:00
parent e21b26a56f
commit e6579625a0

View File

@ -1600,14 +1600,7 @@ slot_new(struct dev *d, struct opt *opt, char *who,
bestidx = i; bestidx = i;
} }
} }
if (bestidx == DEV_NSLOT) { if (bestidx != DEV_NSLOT) {
if (log_level >= 1) {
log_puts(name);
log_putu(unit);
log_puts(": out of sub-device slots\n");
}
return NULL;
}
s = d->slot + bestidx; s = d->slot + bestidx;
s->vol = MIDI_MAXCTL; s->vol = MIDI_MAXCTL;
strlcpy(s->name, name, SLOT_NAMEMAX); strlcpy(s->name, name, SLOT_NAMEMAX);
@ -1622,6 +1615,14 @@ slot_new(struct dev *d, struct opt *opt, char *who,
log_puts("\n"); log_puts("\n");
} }
#endif #endif
goto found;
}
if (log_level >= 1) {
log_puts(name);
log_putu(unit);
log_puts(": out of sub-device slots\n");
}
return NULL;
found: found:
if ((mode & MODE_REC) && (opt->mode & MODE_MON)) { if ((mode & MODE_REC) && (opt->mode & MODE_MON)) {