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/cache.c b/src/cache.c
index 0eb6a88..b9080d4 100644
--- a/src/cache.c
+++ b/src/cache.c
@@ -1581,7 +1581,7 @@
fconf->id = cache_store_flt_id;
fconf->conf = cconf;
fconf->ops = &cache_ops;
- LIST_ADDQ(&proxy->filter_configs, &fconf->list);
+ LIST_APPEND(&proxy->filter_configs, &fconf->list);
rule->arg.act.p[0] = cconf;
return 1;
@@ -2052,7 +2052,7 @@
/* add to the list of cache to init and reinit tmp_cache_config
* for next cache section, if any.
*/
- LIST_ADDQ(&caches_config, &tmp_cache_config->list);
+ LIST_APPEND(&caches_config, &tmp_cache_config->list);
tmp_cache_config = NULL;
return err_code;
}
@@ -2091,8 +2091,8 @@
memcpy(shctx->data, cache_config, sizeof(struct cache));
cache = (struct cache *)shctx->data;
cache->entries = EB_ROOT;
- LIST_ADDQ(&caches, &cache->list);
- LIST_DEL(&cache_config->list);
+ LIST_APPEND(&caches, &cache->list);
+ LIST_DELETE(&cache_config->list);
free(cache_config);
/* Find all references for this cache in the existing filters
@@ -2511,7 +2511,7 @@
}
/* Remove the implicit filter. <cconf> is kept for the explicit one */
- LIST_DEL(&f->list);
+ LIST_DELETE(&f->list);
free(f);
free(name);
break;