git.postgresql.org Git - postgresql.git/commit

git projects / postgresql.git / commit
? search:
summary | shortlog | log | commit | commitdiff | tree
(parent: 910d3a4) | patch
Improve ilist.h's support for deletion of slist elements during iteration.
2013年7月24日 21:41:55 +0000 (17:41 -0400)
2013年7月24日 21:42:34 +0000 (17:42 -0400)
commit fa2fad3c06bfde03594ff38d53acdf9a60c56bb2
Improve ilist.h's support for deletion of slist elements during iteration.

Previously one had to use slist_delete(), implying an additional scan of
the list, making this infrastructure considerably less efficient than
traditional Lists when deletion of element(s) in a long list is needed.
Modify the slist_foreach_modify() macro to support deleting the current
element in O(1) time, by keeping a "prev" pointer in addition to "cur"
and "next". Although this makes iteration with this macro a bit slower,
no real harm is done, since in any scenario where you're not going to
delete the current list element you might as well just use slist_foreach
instead. Improve the comments about when to use each macro.

Back-patch to 9.3 so that we'll have consistent semantics in all branches
that provide ilist.h. Note this is an ABI break for callers of
slist_foreach_modify().

Andres Freund and Tom Lane
src/backend/lib/ilist.c diff | blob | blame | history
src/backend/postmaster/bgworker.c diff | blob | blame | history
src/backend/postmaster/pgstat.c diff | blob | blame | history
src/backend/postmaster/postmaster.c diff | blob | blame | history
src/include/lib/ilist.h diff | blob | blame | history
src/include/postmaster/bgworker_internals.h diff | blob | blame | history
This is the main PostgreSQL git repository.
RSS Atom

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