]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: vars: rename vars_init() to vars_init_head()
authorWilly Tarreau <w@1wt.eu>
Tue, 31 Aug 2021 06:13:25 +0000 (08:13 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 8 Sep 2021 09:10:16 +0000 (11:10 +0200)
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.

include/haproxy/vars.h
src/haproxy.c
src/http_ana.c
src/session.c
src/stream.c
src/tcpcheck.c
src/vars.c

index 0647cf346142bc0fc9d8f01dbd4a760c7f7ca695..a40dce028b3cf79bf7791333a8c3b1c804d0f0f2 100644 (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);
index db957256e9965bf8d04abeb62d683ebb4dd4b1c9..32a08441d782730ee5717059624c76e70aa1cd58 100644 (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)
index 7a0417486d25ac3ecb64c5d3a1d933dcf436b708..2b0c690f03aefa20e3b75a61407d9e2f35764434 100644 (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;
 }
index a11475e83ea9fbb734424c91bd1b38fc113cb7f6..e3601cb4578e39f608528e195c84ae818f710f3c 100644 (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;
index 132ee3abd5503bd1a9aa0115ec79dc016d87212b..27062ea4b8610a8ebfc5e1b86c0efe38d006a63c 100644 (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 {
index e57b05fc6f6c3dd71ae8d7e387b33fc37acbd38c..a3b946c8ced932f3647e027423b3332ca0709989 100644 (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 */
index 1e8e1bd30c387485d8a09e63c72f59766e2f3f86..c58928f6d340e4fbff1bb6076a39a44945fff98f 100644 (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;