From: Takashi Iwai Date: Tue, 17 Feb 2009 16:28:13 +0000 (+0100) Subject: pulse: Add numid check in ctl plugin X-Git-Tag: v1.0.20~5 X-Git-Url: https://git.alsa-project.org/?a=commitdiff_plain;h=a8b557b30242002af6189a587d57fb40f11dda95;p=alsa-plugins.git pulse: Add numid check in ctl plugin Added the check of non-zero numid and optimize the look-up for the element. Signed-off-by: Takashi Iwai --- diff --git a/pulse/ctl_pulse.c b/pulse/ctl_pulse.c index 8a5546c..c6cf9e2 100644 --- a/pulse/ctl_pulse.c +++ b/pulse/ctl_pulse.c @@ -229,6 +229,11 @@ static snd_ctl_ext_key_t pulse_find_elem(snd_ctl_ext_t * ext, const snd_ctl_elem_id_t * id) { const char *name; + unsigned int numid; + + numid = snd_ctl_elem_id_get_numid(id); + if (numid > 0 && numid <= 4) + return numid - 1; name = snd_ctl_elem_id_get_name(id);