summaryrefslogtreecommitdiff
path: root/src/tools
diff options
context:
space:
mode:
authorDavid Rowley2022-11-02 01:06:05 +0000
committerDavid Rowley2022-11-02 01:06:05 +0000
commit7c335b7a20278079e796d62122ef4b821c7fcdf5 (patch)
tree1cfb64fa450e7deb60fa2f8ce933ea1055da024c /src/tools
parent451d1164b9d0cce6acd0b3d0790f09db4c56be0a (diff)
Add doubly linked count list implementation
We have various requirements when using a dlist_head to keep track of the number of items in the list. This, traditionally, has been done by maintaining a counter variable in the calling code. Here we tidy this up by adding "dclist", which is very similar to dlist but also keeps track of the number of items stored in the list. Callers may use the new dclist_count() function when they need to know how many items are stored. Obtaining the count is an O(1) operation. For simplicity reasons, dclist and dlist both use dlist_node as their node type and dlist_iter/dlist_mutable_iter as their iterator type. dclists have all of the same functionality as dlists except there is no function named dclist_delete(). To remove an item from a list dclist_delete_from() must be used. This requires knowing which dclist the given item is stored in. Additionally, here we also convert some dlists where additional code exists to keep track of the number of items stored and to make these use dclists instead. Author: David Rowley Reviewed-by: Bharath Rupireddy, Aleksander Alekseev Discussion: https://postgr.es/m/CAApHDvrtVxr+FXEX0VbViCFKDGxA3tWDgw9oFewNXCJMmwLjLg@mail.gmail.com
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/pgindent/typedefs.list3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/tools/pgindent/typedefs.list b/src/tools/pgindent/typedefs.list
index 2f02cc8f422..9683b0a88e5 100644
--- a/src/tools/pgindent/typedefs.list
+++ b/src/tools/pgindent/typedefs.list
@@ -1514,8 +1514,8 @@ MemoryContextCallback
MemoryContextCallbackFunction
MemoryContextCounters
MemoryContextData
-MemoryContextMethods
MemoryContextMethodID
+MemoryContextMethods
MemoryStatsPrintFunc
MergeAction
MergeActionState
@@ -3194,6 +3194,7 @@ datapagemap_t
dateKEY
datetkn
dce_uuid_t
+dclist_head
decimal
deparse_columns
deparse_context