CLEANUP: lists/tree-wide: rename some list operations to avoid some confusion
The current "ADD" vs "ADDQ" is confusing because when thinking in terms
of appending at the end of a list, "ADD" naturally comes to mind, but
here it does the opposite, it inserts. Several times already it's been
incorrectly used where ADDQ was expected, the latest of which was a
fortunate accident explained in 6fa922562 ("CLEANUP: stream: explain
why we queue the stream at the head of the server list").
Let's use more explicit (but slightly longer) names now:
LIST_ADD -> LIST_INSERT
LIST_ADDQ -> LIST_APPEND
LIST_ADDED -> LIST_INLIST
LIST_DEL -> LIST_DELETE
The same is true for MT_LISTs, including their "TRY" variant.
LIST_DEL_INIT keeps its short name to encourage to use it instead of the
lazier LIST_DELETE which is often less safe.
The change is large (~674 non-comment entries) but is mechanical enough
to remain safe. No permutation was performed, so any out-of-tree code
can easily map older names to new ones.
The list doc was updated.
diff --git a/src/fcgi-app.c b/src/fcgi-app.c
index 2398709..6dca3ec 100644
--- a/src/fcgi-app.c
+++ b/src/fcgi-app.c
@@ -141,7 +141,7 @@
struct logformat_node *lf, *lfb;
list_for_each_entry_safe(lf, lfb, &rule->value, list) {
- LIST_DEL(&lf->list);
+ LIST_DELETE(&lf->list);
release_sample_expr(lf->expr);
free(lf->arg);
free(lf);
@@ -205,12 +205,12 @@
free(fcgi_conf->name);
list_for_each_entry_safe(rule, back, &fcgi_conf->param_rules, list) {
- LIST_DEL(&rule->list);
+ LIST_DELETE(&rule->list);
fcgi_release_rule(rule);
}
list_for_each_entry_safe(rule, back, &fcgi_conf->hdr_rules, list) {
- LIST_DEL(&rule->list);
+ LIST_DELETE(&rule->list);
fcgi_release_rule(rule);
}
@@ -270,9 +270,9 @@
}
if (rule->type == FCGI_RULE_SET_PARAM || rule->type == FCGI_RULE_UNSET_PARAM)
- LIST_ADDQ(&fcgi_conf->param_rules, &rule->list);
+ LIST_APPEND(&fcgi_conf->param_rules, &rule->list);
else /* FCGI_RULE_PASS_HDR/FCGI_RULE_HIDE_HDR */
- LIST_ADDQ(&fcgi_conf->hdr_rules, &rule->list);
+ LIST_APPEND(&fcgi_conf->hdr_rules, &rule->list);
rule = NULL;
}
return 0;
@@ -549,7 +549,7 @@
}
/* Place the filter at its right position */
- LIST_DEL(&f->list);
+ LIST_DELETE(&f->list);
free(f);
ha_free(&name);
break;
@@ -627,7 +627,7 @@
fconf->id = fcgi_flt_id;
fconf->conf = fcgi_conf;
fconf->ops = &fcgi_flt_ops;
- LIST_ADDQ(&curpx->filter_configs, &fconf->list);
+ LIST_APPEND(&curpx->filter_configs, &fconf->list);
end:
return retval;
@@ -743,7 +743,7 @@
goto err;
}
rule->cond = cond;
- LIST_ADDQ(&curapp->conf.rules, &rule->list);
+ LIST_APPEND(&curapp->conf.rules, &rule->list);
return 1;
err:
@@ -1090,12 +1090,12 @@
free(curapp->conf.file);
list_for_each_entry_safe(log, logb, &curapp->logsrvs, list) {
- LIST_DEL(&log->list);
+ LIST_DELETE(&log->list);
free(log);
}
list_for_each_entry_safe(rule, back, &curapp->conf.rules, list) {
- LIST_DEL(&rule->list);
+ LIST_DELETE(&rule->list);
fcgi_release_rule_conf(rule);
}