mixer

FreeBSD OSS mixer library implementation and a complete rewrite of mixer(8)
git clone git://git.margiolis.net/mixer.git
Log | Files | Refs | README

commit 25527829651273ea7aeb3ae7d73f51db34431368
parent 47529790452349925011e29913d897d103cd64af
Author: Christos Margiolis <christos@margiolis.net>
Date:   Sun, 22 Aug 2021 20:21:17 +0300

minor fixes

Diffstat:
Mmixer_lib/mixer.3 | 4++--
Mmixer_lib/mixer.c | 13+++++--------
2 files changed, 7 insertions(+), 10 deletions(-)

diff --git a/mixer_lib/mixer.3 b/mixer_lib/mixer.3 @@ -213,7 +213,7 @@ struct mix_dev { The fields are follows: .Bl -tag -width "parent_mixer" .It Fa parent_mixer -Pointer to the parent mixer. +Pointer to the mixer the device is attached to. .It Fa name Device name given by the OSS API. Devices can have one of the following names: .Bd -ragged @@ -256,7 +256,7 @@ struct mix_ctl { The fields are follows: .Bl -tag -width "parent_dev" .It Fa parent_dev -Parent device for this control. +Pointer to the device the control is attached to. .It Fa id Control ID assigned by the caller. Even though the library will report it, care has to be taken to not give a control the same ID in case diff --git a/mixer_lib/mixer.c b/mixer_lib/mixer.c @@ -228,14 +228,11 @@ mixer_add_ctl(struct mix_dev *parent_dev, int id, const char *name, ctl->mod = mod; ctl->print = print; dp = ctl->parent_dev; - /* Make sure the same ID or name already exists. */ - if (!TAILQ_EMPTY(&dp->ctls)) { - TAILQ_FOREACH(cp, &dp->ctls, ctls) { - if (!strncmp(cp->name, name, sizeof(cp->name)) || - cp->id == id) { - errno = EINVAL; - return (-1); - } + /* Make sure the same ID or name doesn't exist already. */ + TAILQ_FOREACH(cp, &dp->ctls, ctls) { + if (!strncmp(cp->name, name, sizeof(cp->name)) || cp->id == id) { + errno = EINVAL; + return (-1); } } TAILQ_INSERT_TAIL(&dp->ctls, ctl, ctls);