summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndres Freund2023-01-18 18:22:37 +0000
committerAndres Freund2023-01-18 18:26:15 +0000
commit2b16208753770318085b1201a6d101cab2697132 (patch)
tree4d29411377e91c64e930a86f8484dcd772e35c79
parent47bb9db75996232ea71fc1e1888ffb0e70579b54 (diff)
Fix ILIST_DEBUG build
In c8ad4d8166a dlist_member_check()'s arguments were made const. Unfortunately the implementation of dlist_member_check() used dlist_foreach(), which currently doesn't work for const lists. As a workaround, open-code the list iteration. The other check functions already do so. Discussion: https://postgr.es/m/[email protected]
-rw-r--r--src/backend/lib/ilist.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/backend/lib/ilist.c b/src/backend/lib/ilist.c
index f06febd698..aeb7f75cd0 100644
--- a/src/backend/lib/ilist.c
+++ b/src/backend/lib/ilist.c
@@ -59,11 +59,12 @@ slist_delete(slist_head *head, const slist_node *node)
void
dlist_member_check(const dlist_head *head, const dlist_node *node)
{
- dlist_iter iter;
+ const dlist_node *cur;
- dlist_foreach(iter, head)
+ /* iteration open-coded to due to the use of const */
+ for (cur = head->head.next; cur != &head->head; cur = cur->next)
{
- if (iter.cur == node)
+ if (cur == node)
return;
}
elog(ERROR, "double linked list member check failure");