Skip to content

Commit

Permalink
param: Present alias names to tweaks
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
dridi committed Jun 27, 2022
1 parent 6b1305f commit f885637
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions bin/varnishd/mgt/mgt_param_tweak.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}

/*--------------------------------------------------------------------
Expand Down

0 comments on commit f885637

Please sign in to comment.