summaryrefslogtreecommitdiff
path: root/src/ucm/ucm_include.c
diff options
context:
space:
mode:
authorJaroslav Kysela <perex@perex.cz>2020-06-15 19:49:25 +0200
committerJaroslav Kysela <perex@perex.cz>2020-06-15 19:49:27 +0200
commit7036ea07c88b0abe8866e713eaf123971c5ba235 (patch)
treec6802366bb888307795bc1dc868e31f597ef8751 /src/ucm/ucm_include.c
parenteec95e69e5d0dcc16fd8872c1ad680265a96cce3 (diff)
downloadalsa-lib-7036ea07c88b0abe8866e713eaf123971c5ba235.tar.gz
ucm: include - fix compound_merge for arrays
There is a case where the original array has already new indexes (the merged array is placed before the original nodes). Set the temporary index string identifiers to unique strings. Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Diffstat (limited to 'src/ucm/ucm_include.c')
-rw-r--r--src/ucm/ucm_include.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/ucm/ucm_include.c b/src/ucm/ucm_include.c
index 345e4cc9..c69490f4 100644
--- a/src/ucm/ucm_include.c
+++ b/src/ucm/ucm_include.c
@@ -149,6 +149,18 @@ static int compound_merge(const char *id,
}
idx = 0;
+
+ /* for array, use a temporary non-clashing identifier */
+ if (array > 0) {
+ snd_config_for_each(i, next, dst) {
+ n = snd_config_iterator_entry(i);
+ snprintf(tmpid, sizeof(tmpid), "_tmp_%d", idx++);
+ err = snd_config_set_id(n, tmpid);
+ if (err < 0)
+ return err;
+ }
+ }
+
snd_config_for_each(i, next, src) {
n = snd_config_iterator_entry(i);
err = snd_config_remove(n);