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/server.c b/src/server.c
index fb7b750..d8fb65a 100644
--- a/src/server.c
+++ b/src/server.c
@@ -233,7 +233,7 @@
*/
void srv_register_keywords(struct srv_kw_list *kwl)
{
- LIST_ADDQ(&srv_keywords.list, &kwl->list);
+ LIST_APPEND(&srv_keywords.list, &kwl->list);
}
/* Return a pointer to the server keyword <kw>, or NULL if not found. If the
@@ -2151,7 +2151,7 @@
srv->obj_type = OBJ_TYPE_SERVER;
srv->proxy = proxy;
srv->pendconns = EB_ROOT;
- LIST_ADDQ(&servers_list, &srv->global_list);
+ LIST_APPEND(&servers_list, &srv->global_list);
srv->next_state = SRV_ST_RUNNING; /* early server setup */
srv->last_change = now.tv_sec;
@@ -2204,7 +2204,7 @@
}
HA_SPIN_DESTROY(&srv->lock);
- LIST_DEL(&srv->global_list);
+ LIST_DELETE(&srv->global_list);
EXTRA_COUNTERS_FREE(srv->extra_counters);
@@ -2313,7 +2313,7 @@
#endif
free_check(&newsrv->agent);
free_check(&newsrv->check);
- LIST_DEL(&newsrv->global_list);
+ LIST_DELETE(&newsrv->global_list);
}
free(newsrv);
return i - srv->tmpl_info.nb_low;
@@ -5045,7 +5045,7 @@
hash_node = ebmb_entry(node, struct conn_hash_node, node);
eb_delete(node);
- MT_LIST_ADDQ(toremove_list, &hash_node->conn->toremove_list);
+ MT_LIST_APPEND(toremove_list, &hash_node->conn->toremove_list);
i++;
node = next;