Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 2b16208

Browse files
committed
Fix ILIST_DEBUG build
In c8ad4d8 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/20230118182214.co7dp4oahiunwg57@awork3.anarazel.de
1 parent 47bb9db commit 2b16208

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/backend/lib/ilist.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,12 @@ slist_delete(slist_head *head, const slist_node *node)
5959
void
6060
dlist_member_check(const dlist_head *head, const dlist_node *node)
6161
{
62-
dlist_iter iter;
62+
const dlist_node *cur;
6363

64-
dlist_foreach(iter, head)
64+
/* iteration open-coded to due to the use of const */
65+
for (cur = head->head.next; cur != &head->head; cur = cur->next)
6566
{
66-
if (iter.cur == node)
67+
if (cur == node)
6768
return;
6869
}
6970
elog(ERROR, "double linked list member check failure");

0 commit comments

Comments
 (0)