alsa/0052-control-Simplify-using-snd_config_get_bool.patch
Takashi Iwai 1e1ad9f5ff Accepting request 158622 from home:tiwai:branches:multimedia:libs
- More backports of fix patches from upstream:
  0051-Add-sys-types.h-to-include-list.patch
  0052-control-Simplify-using-snd_config_get_bool.patch
  0053-Add-workaround-for-conflicting-IEC958-controls-for-H.patch
  0054-snd_mixer_poll_descriptors_revents-should-loop-over-.patch

OBS-URL: https://build.opensuse.org/request/show/158622
OBS-URL: https://build.opensuse.org/package/show/multimedia:libs/alsa?expand=0&rev=125
2013-03-12 07:14:20 +00:00

89 lines
2.4 KiB
Diff

From 8c6da54073b2c966d9a4e137ba4d521eac92816f Mon Sep 17 00:00:00 2001
From: Takashi Iwai <tiwai@suse.de>
Date: Fri, 12 Oct 2012 12:22:53 +0200
Subject: [PATCH 52/54] control: Simplify using snd_config_get_bool()
snd_config_get_bool() was improved to parse also ASCII strings now,
so we don't have to open-code the boolean parser in
src/control/setup.c any longer.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
src/control/setup.c | 37 ++++++-------------------------------
1 file changed, 6 insertions(+), 31 deletions(-)
diff --git a/src/control/setup.c b/src/control/setup.c
index eecda45..bd3599d 100644
--- a/src/control/setup.c
+++ b/src/control/setup.c
@@ -400,7 +400,6 @@ static int add_elem(snd_sctl_t *h, snd_config_t *_conf, snd_config_t *private_da
{
snd_config_t *conf;
snd_config_iterator_t i, next;
- char *tmp;
int iface = SND_CTL_ELEM_IFACE_MIXER;
const char *name = NULL;
long index = 0;
@@ -464,33 +463,17 @@ static int add_elem(snd_sctl_t *h, snd_config_t *_conf, snd_config_t *private_da
continue;
}
if (strcmp(id, "lock") == 0) {
- if ((err = snd_config_get_ascii(n, &tmp)) < 0) {
- SNDERR("field %s has an invalid type", id);
- goto _err;
- }
- err = snd_config_get_bool_ascii(tmp);
- if (err < 0) {
- SNDERR("field %s is not a boolean", id);
- free(tmp);
+ err = snd_config_get_bool(n);
+ if (err < 0)
goto _err;
- }
lock = err;
- free(tmp);
continue;
}
if (strcmp(id, "preserve") == 0) {
- if ((err = snd_config_get_ascii(n, &tmp)) < 0) {
- SNDERR("field %s has an invalid type", id);
- goto _err;
- }
- err = snd_config_get_bool_ascii(tmp);
- if (err < 0) {
- SNDERR("field %s is not a boolean", id);
- free(tmp);
+ err = snd_config_get_bool(n);
+ if (err < 0)
goto _err;
- }
preserve = err;
- free(tmp);
continue;
}
if (strcmp(id, "value") == 0) {
@@ -502,18 +485,10 @@ static int add_elem(snd_sctl_t *h, snd_config_t *_conf, snd_config_t *private_da
continue;
}
if (strcmp(id, "optional") == 0) {
- if ((err = snd_config_get_ascii(n, &tmp)) < 0) {
- SNDERR("field %s has an invalid type", id);
- goto _err;
- }
- err = snd_config_get_bool_ascii(tmp);
- if (err < 0) {
- SNDERR("field %s is not a boolean", id);
- free(tmp);
+ err = snd_config_get_bool(n);
+ if (err < 0)
goto _err;
- }
optional = err;
- free(tmp);
continue;
}
SNDERR("Unknown field %s", id);
--
1.8.1.4