[alsa-devel] [PATCH 01/13] topology: Use snd_config_get_bool to simplify boolean flag parsing
mengdong.lin at linux.intel.com
mengdong.lin at linux.intel.com
Sun Nov 6 06:11:04 CET 2016
From: Mengdong Lin <mengdong.lin at linux.intel.com>
The link flags in the text conf file are boolean, so this patch uses
snd_config_get_bool() to simplify the code.
Signed-off-by: Mengdong Lin <mengdong.lin at linux.intel.com>
diff --git a/src/topology/pcm.c b/src/topology/pcm.c
index 3f54e94..b7a2df7 100644
--- a/src/topology/pcm.c
+++ b/src/topology/pcm.c
@@ -400,13 +400,14 @@ static int tplg_parse_fe_dai(snd_tplg_t *tplg ATTRIBUTE_UNUSED,
static int parse_flag(snd_config_t *n, unsigned int mask_in,
unsigned int *mask, unsigned int *flags)
{
- const char *val = NULL;
+ int ret;
- if (snd_config_get_string(n, &val) < 0)
- return -EINVAL;
+ ret = snd_config_get_bool(n);
+ if (ret < 0)
+ return ret;
*mask |= mask_in;
- if (strcmp(val, "true") == 0)
+ if (ret)
*flags |= mask_in;
else
*flags &= ~mask_in;
--
2.7.4
More information about the Alsa-devel
mailing list