mirror of https://github.com/ericonr/sndio.git
Swap "if" and "else" code blocks in slot_new() to improve readability.
No behavior change.
This commit is contained in:
parent
e21b26a56f
commit
e6579625a0
31
sndiod/dev.c
31
sndiod/dev.c
|
@ -1600,28 +1600,29 @@ 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) {
|
s = d->slot + bestidx;
|
||||||
|
s->vol = MIDI_MAXCTL;
|
||||||
|
strlcpy(s->name, name, SLOT_NAMEMAX);
|
||||||
|
s->serial = d->serial++;
|
||||||
|
s->unit = unit;
|
||||||
|
#ifdef DEBUG
|
||||||
|
if (log_level >= 3) {
|
||||||
log_puts(name);
|
log_puts(name);
|
||||||
log_putu(unit);
|
log_putu(unit);
|
||||||
log_puts(": out of sub-device slots\n");
|
log_puts(": overwritten slot ");
|
||||||
|
log_putu(bestidx);
|
||||||
|
log_puts("\n");
|
||||||
}
|
}
|
||||||
return NULL;
|
#endif
|
||||||
|
goto found;
|
||||||
}
|
}
|
||||||
s = d->slot + bestidx;
|
if (log_level >= 1) {
|
||||||
s->vol = MIDI_MAXCTL;
|
|
||||||
strlcpy(s->name, name, SLOT_NAMEMAX);
|
|
||||||
s->serial = d->serial++;
|
|
||||||
s->unit = unit;
|
|
||||||
#ifdef DEBUG
|
|
||||||
if (log_level >= 3) {
|
|
||||||
log_puts(name);
|
log_puts(name);
|
||||||
log_putu(unit);
|
log_putu(unit);
|
||||||
log_puts(": overwritten slot ");
|
log_puts(": out of sub-device slots\n");
|
||||||
log_putu(bestidx);
|
|
||||||
log_puts("\n");
|
|
||||||
}
|
}
|
||||||
#endif
|
return NULL;
|
||||||
|
|
||||||
found:
|
found:
|
||||||
if ((mode & MODE_REC) && (opt->mode & MODE_MON)) {
|
if ((mode & MODE_REC) && (opt->mode & MODE_MON)) {
|
||||||
|
|
Loading…
Reference in New Issue