ucm: fix variant issue where variables or macros are overwritten

It is necessary to reset the state logic before each verb variant
is parsed. So save the original variable list and macros and
restore them before each parser iteration.

BugLink: https://github.com/alsa-project/alsa-ucm-conf/pull/633
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
Jaroslav Kysela 2025-11-07 17:59:12 +01:00
parent f6dce4f9d0
commit bd0ce670c2
3 changed files with 82 additions and 1 deletions

View file

@ -327,6 +327,8 @@ struct ctl_list *uc_mgr_get_ctl_by_name(snd_use_case_mgr_t *uc_mgr,
snd_ctl_t *uc_mgr_get_ctl(snd_use_case_mgr_t *uc_mgr);
void uc_mgr_free_ctl_list(snd_use_case_mgr_t *uc_mgr);
void uc_mgr_free_value(struct list_head *base);
int uc_mgr_add_value(struct list_head *base, const char *key, char *val);
const char *uc_mgr_get_variable(snd_use_case_mgr_t *uc_mgr,
@ -338,6 +340,8 @@ int uc_mgr_set_variable(snd_use_case_mgr_t *uc_mgr,
int uc_mgr_delete_variable(snd_use_case_mgr_t *uc_mgr, const char *name);
int uc_mgr_duplicate_variables(struct list_head *dst, struct list_head *src);
int uc_mgr_get_substituted_value(snd_use_case_mgr_t *uc_mgr,
char **_rvalue,
const char *value);