From: Willy Tarreau Date: Tue, 31 Aug 2021 06:13:25 +0000 (+0200) Subject: MINOR: vars: rename vars_init() to vars_init_head() X-Git-Tag: v2.5-dev7~34 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b7bfcb3ff317a5cd50e787375bff02b2acc70c0d;p=thirdparty%2Fhaproxy.git 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. --- diff --git a/include/haproxy/vars.h b/include/haproxy/vars.h index 0647cf3461..a40dce028b 100644 --- a/include/haproxy/vars.h +++ b/include/haproxy/vars.h @@ -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); diff --git a/src/haproxy.c b/src/haproxy.c index db957256e9..32a08441d7 100644 --- a/src/haproxy.c +++ b/src/haproxy.c @@ -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) diff --git a/src/http_ana.c b/src/http_ana.c index 7a0417486d..2b0c690f03 100644 --- a/src/http_ana.c +++ b/src/http_ana.c @@ -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; } diff --git a/src/session.c b/src/session.c index a11475e83e..e3601cb457 100644 --- a/src/session.c +++ b/src/session.c @@ -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; diff --git a/src/stream.c b/src/stream.c index 132ee3abd5..27062ea4b8 100644 --- a/src/stream.c +++ b/src/stream.c @@ -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 { diff --git a/src/tcpcheck.c b/src/tcpcheck.c index e57b05fc6f..a3b946c8ce 100644 --- a/src/tcpcheck.c +++ b/src/tcpcheck.c @@ -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 */ diff --git a/src/vars.c b/src/vars.c index 1e8e1bd30c..c58928f6d3 100644 --- a/src/vars.c +++ b/src/vars.c @@ -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;