[alsa-devel] [alsa-lib][PATCH 6/6] test: use position offset macro of TLV data

Takashi Sakamoto o-takashi at sakamocchi.jp
Tue May 15 14:36:39 CEST 2018


A series of SNDRV_CTL_TLVO_XXX macro was introduced for position offset
of TLV data. This commit applies a code optimization.

Signed-off-by: Takashi Sakamoto <o-takashi at sakamocchi.jp>
---
 test/user-ctl-element-set.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/test/user-ctl-element-set.c b/test/user-ctl-element-set.c
index e94152b9..fee130e2 100644
--- a/test/user-ctl-element-set.c
+++ b/test/user-ctl-element-set.c
@@ -660,7 +660,7 @@ static int check_tlv(struct elem_set_trial *trial)
 	if (err < 0)
 		return err;
 
-	len = tlv[1] + sizeof(unsigned int) * 2;
+	len = tlv[SNDRV_CTL_TLVO_LEN] + sizeof(unsigned int) * 2;
 	curr = malloc(len);
 	if (curr == NULL) {
 		free(tlv);
-- 
2.14.1



More information about the Alsa-devel mailing list