All callers of vars_prune_* currently check the list for emptiness.
Let's leave that to vars_prune() itself, it will ease some changes in
the code. Thanks to the previous inlining of the vars_prune() function,
there's no performance loss, and even a very tiny 0.1% gain.
size += var_clear(var, 1);
}
+ if (!size)
+ return;
+
var_accounting_diff(vars, sess, strm, -size);
}
/* prune the request variables if not already done and swap to the response variables. */
if (s->vars_reqres.scope != SCOPE_RES) {
- if (!LIST_ISEMPTY(&s->vars_reqres.head))
- vars_prune(&s->vars_reqres, s->sess, s);
+ vars_prune(&s->vars_reqres, s->sess, s);
vars_init_head(&s->vars_reqres, SCOPE_RES);
}
txn->srv_cookie = NULL;
txn->cli_cookie = NULL;
- if (!LIST_ISEMPTY(&s->vars_txn.head))
- vars_prune(&s->vars_txn, s->sess, s);
- if (!LIST_ISEMPTY(&s->vars_reqres.head))
- vars_prune(&s->vars_reqres, s->sess, s);
+ vars_prune(&s->vars_txn, s->sess, s);
+ vars_prune(&s->vars_reqres, s->sess, s);
b_free(&txn->l7_buffer);
}
/* Cleanup all variable contexts. */
- if (!LIST_ISEMPTY(&s->vars_txn.head))
- vars_prune(&s->vars_txn, s->sess, s);
- if (!LIST_ISEMPTY(&s->vars_reqres.head))
- vars_prune(&s->vars_reqres, s->sess, s);
+ vars_prune(&s->vars_txn, s->sess, s);
+ vars_prune(&s->vars_reqres, s->sess, s);
stream_store_counters(s);
pool_free(pool_head_stk_ctr, s->stkctr);
if (sc_state_in(scb->state, SC_SB_REQ|SC_SB_QUE|SC_SB_TAR|SC_SB_ASS)) {
/* prune the request variables and swap to the response variables. */
if (s->vars_reqres.scope != SCOPE_RES) {
- if (!LIST_ISEMPTY(&s->vars_reqres.head))
- vars_prune(&s->vars_reqres, s->sess, s);
+ vars_prune(&s->vars_reqres, s->sess, s);
vars_init_head(&s->vars_reqres, SCOPE_RES);
}
size += var_clear(var, 1);
}
+ if (!size)
+ return;
+
if (var_sess_limit)
_HA_ATOMIC_SUB(&vars->size, size);
if (var_proc_limit || var_global_limit)