- Notifications
You must be signed in to change notification settings - Fork5
Commitfa2fad3
committed
Improve ilist.h's support for deletion of slist elements during iteration.
Previously one had to use slist_delete(), implying an additional scan ofthe list, making this infrastructure considerably less efficient thantraditional Lists when deletion of element(s) in a long list is needed.Modify the slist_foreach_modify() macro to support deleting the currentelement 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 todelete the current list element you might as well just use slist_foreachinstead. Improve the comments about when to use each macro.Back-patch to 9.3 so that we'll have consistent semantics in all branchesthat provide ilist.h. Note this is an ABI break for callers ofslist_foreach_modify().Andres Freund and Tom Lane1 parent910d3a4 commitfa2fad3
File tree
6 files changed
+72
-20
lines changed- src
- backend
- lib
- postmaster
- include
- lib
- postmaster
6 files changed
+72
-20
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
| 31 | + | |
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
267 | 267 | | |
268 | 268 | | |
269 | 269 | | |
270 | | - | |
271 | | - | |
272 | | - | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
273 | 275 | | |
274 | 276 | | |
275 | | - | |
| 277 | + | |
276 | 278 | | |
| 279 | + | |
277 | 280 | | |
278 | 281 | | |
| 282 | + | |
| 283 | + | |
279 | 284 | | |
280 | 285 | | |
281 | 286 | | |
| |||
284 | 289 | | |
285 | 290 | | |
286 | 291 | | |
287 | | - | |
| 292 | + | |
288 | 293 | | |
289 | 294 | | |
290 | 295 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3602 | 3602 | | |
3603 | 3603 | | |
3604 | 3604 | | |
| 3605 | + | |
| 3606 | + | |
| 3607 | + | |
| 3608 | + | |
| 3609 | + | |
| 3610 | + | |
| 3611 | + | |
3605 | 3612 | | |
3606 | 3613 | | |
3607 | 3614 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1452 | 1452 | | |
1453 | 1453 | | |
1454 | 1454 | | |
1455 | | - | |
| 1455 | + | |
1456 | 1456 | | |
1457 | 1457 | | |
1458 | 1458 | | |
| |||
5641 | 5641 | | |
5642 | 5642 | | |
5643 | 5643 | | |
5644 | | - | |
| 5644 | + | |
5645 | 5645 | | |
5646 | 5646 | | |
5647 | 5647 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
211 | 211 | | |
212 | 212 | | |
213 | 213 | | |
214 | | - | |
215 | | - | |
216 | | - | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
217 | 222 | | |
218 | 223 | | |
219 | 224 | | |
| |||
224 | 229 | | |
225 | 230 | | |
226 | 231 | | |
227 | | - | |
| 232 | + | |
| 233 | + | |
228 | 234 | | |
229 | | - | |
230 | | - | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
231 | 238 | | |
232 | 239 | | |
233 | 240 | | |
234 | 241 | | |
235 | 242 | | |
| 243 | + | |
236 | 244 | | |
237 | 245 | | |
238 | 246 | | |
| |||
243 | 251 | | |
244 | 252 | | |
245 | 253 | | |
246 | | - | |
| 254 | + | |
247 | 255 | | |
248 | 256 | | |
249 | 257 | | |
| |||
578 | 586 | | |
579 | 587 | | |
580 | 588 | | |
| 589 | + | |
581 | 590 | | |
582 | 591 | | |
583 | 592 | | |
| |||
679 | 688 | | |
680 | 689 | | |
681 | 690 | | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
682 | 714 | | |
683 | 715 | | |
684 | 716 | | |
| |||
706 | 738 | | |
707 | 739 | | |
708 | 740 | | |
709 | | - | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
710 | 747 | | |
711 | 748 | | |
712 | 749 | | |
| |||
720 | 757 | | |
721 | 758 | | |
722 | 759 | | |
723 | | - | |
724 | | - | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
725 | 763 | | |
726 | 764 | | |
727 | 765 | | |
728 | 766 | | |
729 | | - | |
| 767 | + | |
| 768 | + | |
730 | 769 | | |
731 | 770 | | |
| 771 | + | |
732 | 772 | | |
733 | 773 | | |
734 | 774 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
42 | | - | |
| 42 | + | |
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
| |||
0 commit comments
Comments
(0)