git.postgresql.org Git - postgresql.git/commitdiff

git projects / postgresql.git / commitdiff
? search:
summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 47bb9db)
Fix ILIST_DEBUG build
2023年1月18日 18:22:37 +0000 (10:22 -0800)
2023年1月18日 18:26:15 +0000 (10:26 -0800)
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/20230118182214.co7dp4oahiunwg57@awork3.anarazel.de


diff --git a/src/backend/lib/ilist.c b/src/backend/lib/ilist.c
index f06febd6985781eb1dcf2c546d52e7cc10da8b37..aeb7f75cd0c3b49a082b640db1bfff4cb909f667 100644 (file)
--- 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");
This is the main PostgreSQL git repository.
RSS Atom

AltStyle によって変換されたページ (->オリジナル) /