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/mux_h1.c b/src/mux_h1.c
index aa885b8..e8a7d6b 100644
--- a/src/mux_h1.c
+++ b/src/mux_h1.c
@@ -448,11 +448,11 @@
{
struct buffer *buf = NULL;
- if (likely(!LIST_ADDED(&h1c->buf_wait.list)) &&
+ if (likely(!LIST_INLIST(&h1c->buf_wait.list)) &&
unlikely((buf = b_alloc(bptr)) == NULL)) {
h1c->buf_wait.target = h1c;
h1c->buf_wait.wakeup_cb = h1_buf_available;
- LIST_ADDQ(&ti->buffer_wq, &h1c->buf_wait.list);
+ LIST_APPEND(&ti->buffer_wq, &h1c->buf_wait.list);
}
return buf;
}
@@ -913,7 +913,7 @@
}
- if (LIST_ADDED(&h1c->buf_wait.list))
+ if (LIST_INLIST(&h1c->buf_wait.list))
LIST_DEL_INIT(&h1c->buf_wait.list);
h1_release_buf(h1c, &h1c->ibuf);