forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit7c335b7
committed
Add doubly linked count list implementation
We have various requirements when using a dlist_head to keep track of thenumber of items in the list. This, traditionally, has been done bymaintaining a counter variable in the calling code. Here we tidy this upby adding "dclist", which is very similar to dlist but also keeps track ofthe number of items stored in the list.Callers may use the new dclist_count() function when they need to know howmany items are stored. Obtaining the count is an O(1) operation.For simplicity reasons, dclist and dlist both use dlist_node as their nodetype and dlist_iter/dlist_mutable_iter as their iterator type. dclistshave all of the same functionality as dlists except there is no functionnamed dclist_delete(). To remove an item from a list dclist_delete_from()must be used. This requires knowing which dclist the given item is storedin.Additionally, here we also convert some dlists where additional codeexists to keep track of the number of items stored and to make these usedclists instead.Author: David RowleyReviewed-by: Bharath Rupireddy, Aleksander AlekseevDiscussion:https://postgr.es/m/CAApHDvrtVxr+FXEX0VbViCFKDGxA3tWDgw9oFewNXCJMmwLjLg@mail.gmail.com1 parent451d116 commit7c335b7
File tree
11 files changed
+448
-109
lines changed- src
- backend
- access
- heap
- transam
- lib
- replication/logical
- utils
- activity
- adt
- include
- lib
- replication
- utils
- tools/pgindent
11 files changed
+448
-109
lines changedLines changed: 11 additions & 14 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
196 | 196 |
| |
197 | 197 |
| |
198 | 198 |
| |
199 |
| - | |
200 |
| - | |
| 199 | + | |
201 | 200 |
| |
202 | 201 |
| |
203 | 202 |
| |
| |||
864 | 863 |
| |
865 | 864 |
| |
866 | 865 |
| |
| 866 | + | |
867 | 867 |
| |
868 | 868 |
| |
869 |
| - | |
| 869 | + | |
870 | 870 |
| |
871 | 871 |
| |
872 | 872 |
| |
873 | 873 |
| |
874 | 874 |
| |
875 | 875 |
| |
876 | 876 |
| |
877 |
| - | |
| 877 | + | |
878 | 878 |
| |
879 | 879 |
| |
880 | 880 |
| |
881 | 881 |
| |
882 | 882 |
| |
883 | 883 |
| |
884 | 884 |
| |
885 |
| - | |
| 885 | + | |
886 | 886 |
| |
887 | 887 |
| |
888 | 888 |
| |
889 | 889 |
| |
890 | 890 |
| |
891 |
| - | |
| 891 | + | |
892 | 892 |
| |
893 | 893 |
| |
894 | 894 |
| |
895 |
| - | |
| 895 | + | |
896 | 896 |
| |
897 | 897 |
| |
898 | 898 |
| |
899 | 899 |
| |
900 | 900 |
| |
901 |
| - | |
| 901 | + | |
902 | 902 |
| |
903 | 903 |
| |
904 | 904 |
| |
905 | 905 |
| |
906 |
| - | |
907 | 906 |
| |
908 | 907 |
| |
909 |
| - | |
| 908 | + | |
910 | 909 |
| |
911 | 910 |
| |
912 | 911 |
| |
| |||
1002 | 1001 |
| |
1003 | 1002 |
| |
1004 | 1003 |
| |
1005 |
| - | |
1006 |
| - | |
| 1004 | + | |
1007 | 1005 |
| |
1008 | 1006 |
| |
1009 | 1007 |
| |
| |||
1017 | 1015 |
| |
1018 | 1016 |
| |
1019 | 1017 |
| |
1020 |
| - | |
1021 |
| - | |
| 1018 | + | |
1022 | 1019 |
| |
1023 | 1020 |
| |
1024 | 1021 |
| |
|
Lines changed: 16 additions & 18 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
319 | 319 |
| |
320 | 320 |
| |
321 | 321 |
| |
322 |
| - | |
323 |
| - | |
| 322 | + | |
324 | 323 |
| |
325 | 324 |
| |
326 | 325 |
| |
| |||
1504 | 1503 |
| |
1505 | 1504 |
| |
1506 | 1505 |
| |
1507 |
| - | |
| 1506 | + | |
1508 | 1507 |
| |
1509 |
| - | |
| 1508 | + | |
| 1509 | + | |
1510 | 1510 |
| |
1511 | 1511 |
| |
1512 | 1512 |
| |
| |||
1518 | 1518 |
| |
1519 | 1519 |
| |
1520 | 1520 |
| |
1521 |
| - | |
| 1521 | + | |
1522 | 1522 |
| |
1523 | 1523 |
| |
1524 | 1524 |
| |
| |||
1542 | 1542 |
| |
1543 | 1543 |
| |
1544 | 1544 |
| |
1545 |
| - | |
| 1545 | + | |
1546 | 1546 |
| |
1547 |
| - | |
| 1547 | + | |
| 1548 | + | |
1548 | 1549 |
| |
1549 | 1550 |
| |
1550 | 1551 |
| |
| |||
1566 | 1567 |
| |
1567 | 1568 |
| |
1568 | 1569 |
| |
1569 |
| - | |
| 1570 | + | |
1570 | 1571 |
| |
1571 | 1572 |
| |
1572 | 1573 |
| |
| |||
1610 | 1611 |
| |
1611 | 1612 |
| |
1612 | 1613 |
| |
1613 |
| - | |
1614 |
| - | |
| 1614 | + | |
| 1615 | + | |
1615 | 1616 |
| |
1616 | 1617 |
| |
1617 | 1618 |
| |
1618 |
| - | |
1619 |
| - | |
1620 |
| - | |
| 1619 | + | |
| 1620 | + | |
1621 | 1621 |
| |
1622 |
| - | |
| 1622 | + | |
1623 | 1623 |
| |
1624 | 1624 |
| |
1625 | 1625 |
| |
| |||
1699 | 1699 |
| |
1700 | 1700 |
| |
1701 | 1701 |
| |
1702 |
| - | |
1703 |
| - | |
| 1702 | + | |
1704 | 1703 |
| |
1705 | 1704 |
| |
1706 | 1705 |
| |
| |||
1766 | 1765 |
| |
1767 | 1766 |
| |
1768 | 1767 |
| |
1769 |
| - | |
1770 |
| - | |
| 1768 | + | |
1771 | 1769 |
| |
1772 | 1770 |
| |
1773 | 1771 |
| |
|
Lines changed: 17 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
52 | 52 |
| |
53 | 53 |
| |
54 | 54 |
| |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
55 | 72 |
| |
56 | 73 |
| |
57 | 74 |
| |
|
Lines changed: 12 additions & 23 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
349 | 349 |
| |
350 | 350 |
| |
351 | 351 |
| |
352 |
| - | |
353 |
| - | |
354 | 352 |
| |
355 | 353 |
| |
356 | 354 |
| |
| |||
368 | 366 |
| |
369 | 367 |
| |
370 | 368 |
| |
371 |
| - | |
| 369 | + | |
372 | 370 |
| |
373 | 371 |
| |
374 | 372 |
| |
| |||
1553 | 1551 |
| |
1554 | 1552 |
| |
1555 | 1553 |
| |
1556 |
| - | |
1557 |
| - | |
1558 |
| - | |
1559 |
| - | |
1560 |
| - | |
1561 |
| - | |
| 1554 | + | |
1562 | 1555 |
| |
1563 | 1556 |
| |
1564 | 1557 |
| |
| |||
3309 | 3302 |
| |
3310 | 3303 |
| |
3311 | 3304 |
| |
3312 |
| - | |
3313 |
| - | |
| 3305 | + | |
3314 | 3306 |
| |
3315 | 3307 |
| |
3316 | 3308 |
| |
| |||
3323 | 3315 |
| |
3324 | 3316 |
| |
3325 | 3317 |
| |
3326 |
| - | |
3327 |
| - | |
| 3318 | + | |
3328 | 3319 |
| |
3329 | 3320 |
| |
3330 | 3321 |
| |
| |||
3342 | 3333 |
| |
3343 | 3334 |
| |
3344 | 3335 |
| |
3345 |
| - | |
3346 |
| - | |
3347 |
| - | |
| 3336 | + | |
3348 | 3337 |
| |
3349 |
| - | |
3350 | 3338 |
| |
3351 | 3339 |
| |
3352 |
| - | |
3353 |
| - | |
| 3340 | + | |
| 3341 | + | |
| 3342 | + | |
3354 | 3343 |
| |
3355 |
| - | |
3356 |
| - | |
3357 |
| - | |
| 3344 | + | |
| 3345 | + | |
| 3346 | + | |
3358 | 3347 |
| |
3359 | 3348 |
| |
3360 | 3349 |
| |
| |||
3363 | 3352 |
| |
3364 | 3353 |
| |
3365 | 3354 |
| |
3366 |
| - | |
| 3355 | + | |
3367 | 3356 |
| |
3368 | 3357 |
| |
3369 | 3358 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1688 | 1688 |
| |
1689 | 1689 |
| |
1690 | 1690 |
| |
1691 |
| - | |
| 1691 | + | |
1692 | 1692 |
| |
1693 | 1693 |
| |
1694 | 1694 |
| |
|
0 commit comments
Comments
(0)