[master] f8856377b param: Present alias names to tweaks
Dridi Boukelmoune
dridi.boukelmoune at gmail.com
Mon Jun 27 13:38:06 UTC 2022
commit f8856377b4f89c2ed1f5acf53a6dc53855744138
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date: Tue May 31 07:59:17 2022 +0200
param: Present alias names to tweaks
Instead of simply resolving the original parameter and passing it on
pristine to its tweak, build an intermediary param spec that has all
the properties of the original with the name of the alias.
This enables special handling of deprecated aliases with their
replacements.
diff --git a/bin/varnishd/mgt/mgt_param_tweak.c b/bin/varnishd/mgt/mgt_param_tweak.c
index 6f0e26803..cba614415 100644
--- a/bin/varnishd/mgt/mgt_param_tweak.c
+++ b/bin/varnishd/mgt/mgt_param_tweak.c
@@ -565,9 +565,15 @@ tweak_storage(struct vsb *vsb, const struct parspec *par, const char *arg)
int v_matchproto_(tweak_t)
tweak_alias(struct vsb *vsb, const struct parspec *par, const char *arg)
{
-
- par = TRUST_ME(par->priv);
- return (par->func(vsb, par, arg));
+ const struct parspec *orig;
+ struct parspec alias[1];
+
+ orig = TRUST_ME(par->priv);
+ AN(orig);
+ memcpy(alias, orig, sizeof *orig);
+ alias->name = par->name;
+ alias->priv = TRUST_ME(orig);
+ return (alias->func(vsb, alias, arg));
}
/*--------------------------------------------------------------------
More information about the varnish-commit
mailing list