summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaroslav Kysela <perex@perex.cz>2022-05-19 11:27:37 +0200
committerJaroslav Kysela <perex@perex.cz>2022-05-19 11:27:40 +0200
commit5f0479762bc249720e2967bdbd0e737d061cdf54 (patch)
tree841a39f7336c74807f8b35fb391e429f7fe2d5a3
parent2389f04541ad7767c5499b672f7d86d133ba117e (diff)
downloadalsa-lib-5f0479762bc249720e2967bdbd0e737d061cdf54.tar.gz
ucm: macro - make argument names shorter
It seems that the use the macro name as the variable prefix is too large. Use just two underscores as prefix for the macro arguments to make macro definitions more readable. Signed-off-by: Jaroslav Kysela <perex@perex.cz>
-rw-r--r--src/ucm/parser.c4
-rw-r--r--src/ucm/ucm_confdoc.h12
2 files changed, 8 insertions, 8 deletions
diff --git a/src/ucm/parser.c b/src/ucm/parser.c
index b77544ba..b5ee62a7 100644
--- a/src/ucm/parser.c
+++ b/src/ucm/parser.c
@@ -419,7 +419,7 @@ static int evaluate_macro1(snd_use_case_mgr_t *uc_mgr,
err = snd_config_get_ascii(n, &var);
if (err < 0)
return err;
- snprintf(name, sizeof(name), "%s_%s", mid, id);
+ snprintf(name, sizeof(name), "__%s", id);
err = uc_mgr_set_variable(uc_mgr, name, var);
free(var);
if (err < 0)
@@ -444,7 +444,7 @@ static int evaluate_macro1(snd_use_case_mgr_t *uc_mgr,
err = snd_config_get_id(n, &id);
if (err < 0)
return err;
- snprintf(name, sizeof(name), "%s_%s", mid, id);
+ snprintf(name, sizeof(name), "__%s", id);
err = uc_mgr_delete_variable(uc_mgr, name);
if (err < 0)
return err;
diff --git a/src/ucm/ucm_confdoc.h b/src/ucm/ucm_confdoc.h
index dbaf93af..42c331b6 100644
--- a/src/ucm/ucm_confdoc.h
+++ b/src/ucm/ucm_confdoc.h
@@ -461,16 +461,16 @@ macro like:
~~~{.html}
DefineMacro.macro1 {
- Define.a "${var:macro1_arg1}"
- Define.b "${var:macro1_other}"
+ Define.a "${var:__arg1}"
+ Define.b "${var:__other}"
# Device or any other block may be defined here...
}
~~~
-The arguments in the macro are refered as the variables with the macro
-name prefix and underscore (*'_'*) delimiter. The configuration block
-in the DefineMacro subtree is always evaluated (including arguments
-and variables) at the time of the instantiation.
+The arguments in the macro are refered as the variables with the double
+underscore name prefix (like *__variable*). The configuration block in
+the DefineMacro subtree is always evaluated (including arguments and variables)
+at the time of the instantiation.
The macros can be instantiated (expanded) using: