forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit5bcab11
committed
Add castNode(type, ptr) for safe casting between NodeTag based types.
The new function allows to cast from one NodeTag based type toanother, while asserting that the conversion is valid. This replacesthe common pattern of doing a cast and a Assert(IsA(ptr, type))close-by.As this seems likely to be used pervasively, we decided to backpatchthis change the addition of this macro. Otherwise backpatched fixesare more likely not to work on back-branches.On branches before 9.6, where we do not yet rely on inline functionsbeing available, the type assertion is only performed if PG_USE_INLINEsupport is detected. The cast obviously is performed regardless.For the benefit of verifying the macro compiles in the back-branches,this commit contains a single use of the new macro. On master, asomewhat larger conversion will be committed separately.Author: Peter Eisentraut and Andres FreundReviewed-By: Tom LaneDiscussion:https://postgr.es/m/c5d387d9-3440-f5e0-f9d4-71d53b9fbe52@2ndquadrant.comBackpatch: 9.2-1 parent331f8c3 commit5bcab11
2 files changed
+21
-1
lines changedLines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
846 | 846 |
| |
847 | 847 |
| |
848 | 848 |
| |
849 |
| - | |
| 849 | + | |
850 | 850 |
| |
851 | 851 |
| |
852 | 852 |
| |
|
Lines changed: 20 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
558 | 558 |
| |
559 | 559 |
| |
560 | 560 |
| |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
561 | 581 |
| |
562 | 582 |
| |
563 | 583 |
| |
|
0 commit comments
Comments
(0)