MINOR: vars: rename vars_init() to vars_init_head()

The vars_init() name is particularly confusing as it does not initialize
the variables code but the head of a list of variables passed in
arguments. And we'll soon need to have proper initialization code, so
let's rename it now.
This commit is contained in:
Willy Tarreau 2021-08-31 08:13:25 +02:00
parent 10080716bf
commit b7bfcb3ff3
7 changed files with 12 additions and 12 deletions

View File

@ -29,7 +29,7 @@
extern struct vars proc_vars;
void vars_init(struct vars *vars, enum vars_scope scope);
void vars_init_head(struct vars *vars, enum vars_scope scope);
void var_accounting_diff(struct vars *vars, struct session *sess, struct stream *strm, int size);
unsigned int var_clear(struct var *var);
void vars_prune(struct vars *vars, struct session *sess, struct stream *strm);

View File

@ -1529,7 +1529,7 @@ static void init(int argc, char **argv)
hlua_init();
/* Initialize process vars */
vars_init(&proc_vars, SCOPE_PROC);
vars_init_head(&proc_vars, SCOPE_PROC);
global.tune.options |= GTUNE_USE_SELECT; /* select() is always available */
#if defined(USE_POLL)

View File

@ -2967,7 +2967,7 @@ int http_eval_after_res_rules(struct stream *s)
if (s->vars_reqres.scope != SCOPE_RES) {
if (!LIST_ISEMPTY(&s->vars_reqres.head))
vars_prune(&s->vars_reqres, s->sess, s);
vars_init(&s->vars_reqres, SCOPE_RES);
vars_init_head(&s->vars_reqres, SCOPE_RES);
}
ret = http_res_get_intercept_rule(s->be, &s->be->http_after_res_rules, s);
@ -5095,8 +5095,8 @@ struct http_txn *http_create_txn(struct stream *s)
txn->auth.method = HTTP_AUTH_UNKNOWN;
vars_init(&s->vars_txn, SCOPE_TXN);
vars_init(&s->vars_reqres, SCOPE_REQ);
vars_init_head(&s->vars_txn, SCOPE_TXN);
vars_init_head(&s->vars_reqres, SCOPE_REQ);
return txn;
}

View File

@ -47,7 +47,7 @@ struct session *session_new(struct proxy *fe, struct listener *li, enum obj_type
sess->accept_date = date; /* user-visible date for logging */
sess->tv_accept = now; /* corrected date for internal use */
memset(sess->stkctr, 0, sizeof(sess->stkctr));
vars_init(&sess->vars, SCOPE_SESS);
vars_init_head(&sess->vars, SCOPE_SESS);
sess->task = NULL;
sess->t_handshake = -1; /* handshake not done yet */
sess->t_idle = -1;

View File

@ -451,8 +451,8 @@ struct stream *stream_new(struct session *sess, enum obj_type *origin, struct bu
/* Initialise all the variables contexts even if not used.
* This permits to prune these contexts without errors.
*/
vars_init(&s->vars_txn, SCOPE_TXN);
vars_init(&s->vars_reqres, SCOPE_REQ);
vars_init_head(&s->vars_txn, SCOPE_TXN);
vars_init_head(&s->vars_reqres, SCOPE_REQ);
/* this part should be common with other protocols */
if (si_reset(&s->si[0]) < 0)
@ -2201,7 +2201,7 @@ struct task *process_stream(struct task *t, void *context, unsigned int state)
if (s->vars_reqres.scope != SCOPE_RES) {
if (!LIST_ISEMPTY(&s->vars_reqres.head))
vars_prune(&s->vars_reqres, s->sess, s);
vars_init(&s->vars_reqres, SCOPE_RES);
vars_init_head(&s->vars_reqres, SCOPE_RES);
}
do {

View File

@ -2118,7 +2118,7 @@ int tcpcheck_main(struct check *check)
set_server_check_status(check, HCHK_STATUS_SOCKERR, trash.area);
goto out_end_tcpcheck;
}
vars_init(&check->vars, SCOPE_CHECK);
vars_init_head(&check->vars, SCOPE_CHECK);
rule = LIST_NEXT(check->tcpcheck_rules->list, typeof(rule), list);
/* Preset tcp-check variables */

View File

@ -196,8 +196,8 @@ void vars_prune_per_sess(struct vars *vars)
_HA_ATOMIC_SUB(&var_global_size, size);
}
/* This function init a list of variables. */
void vars_init(struct vars *vars, enum vars_scope scope)
/* This function initializes a variables list head */
void vars_init_head(struct vars *vars, enum vars_scope scope)
{
LIST_INIT(&vars->head);
vars->scope = scope;