[PATCH 01/13] topology: Use snd_config_get_bool to simplify boolean flag parsing

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Mengdong Lin <mengdong.lin@xxxxxxxxxxxxxxx>

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@xxxxxxxxxxxxxxx>

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

_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxx
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel



[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux