mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-11-04 13:30:08 -05:00
topology: Use snd_config_get_bool to simplify boolean flag parsing
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@linux.intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
d170e1ffa1
commit
fc8e5ab4a0
1 changed files with 5 additions and 4 deletions
|
|
@ -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,
|
static int parse_flag(snd_config_t *n, unsigned int mask_in,
|
||||||
unsigned int *mask, unsigned int *flags)
|
unsigned int *mask, unsigned int *flags)
|
||||||
{
|
{
|
||||||
const char *val = NULL;
|
int ret;
|
||||||
|
|
||||||
if (snd_config_get_string(n, &val) < 0)
|
ret = snd_config_get_bool(n);
|
||||||
return -EINVAL;
|
if (ret < 0)
|
||||||
|
return ret;
|
||||||
|
|
||||||
*mask |= mask_in;
|
*mask |= mask_in;
|
||||||
if (strcmp(val, "true") == 0)
|
if (ret)
|
||||||
*flags |= mask_in;
|
*flags |= mask_in;
|
||||||
else
|
else
|
||||||
*flags &= ~mask_in;
|
*flags &= ~mask_in;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue