]> git.alsa-project.org Git - alsa-lib.git/commitdiff
topology: Use snd_config_get_bool to simplify boolean flag parsing
authorMengdong Lin <mengdong.lin@linux.intel.com>
Sun, 6 Nov 2016 05:11:04 +0000 (13:11 +0800)
committerTakashi Iwai <tiwai@suse.de>
Tue, 8 Nov 2016 15:33:15 +0000 (16:33 +0100)
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>
src/topology/pcm.c

index 3f54e9496849b5bd1984b0ea2cf23d1434ddc6a2..b7a2df76b106629786f92b1a600b3338f7af1d4e 100644 (file)
@@ -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;