]> git.alsa-project.org Git - alsa-plugins.git/commitdiff
pulse: Add numid check in ctl plugin
authorTakashi Iwai <tiwai@suse.de>
Tue, 17 Feb 2009 16:28:13 +0000 (17:28 +0100)
committerTakashi Iwai <tiwai@suse.de>
Tue, 17 Feb 2009 16:28:13 +0000 (17:28 +0100)
Added the check of non-zero numid and optimize the look-up for the
element.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
pulse/ctl_pulse.c

index 8a5546c589a2a1c4669ac8d182076afb3aadd9b4..c6cf9e2d5046f2e0a70597f842bcb0c5478dff82 100644 (file)
@@ -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);