Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc58513f

Browse files
committed
Future-proof the recursion inside ExecShutdownNode().
The API contract for planstate_tree_walker() callbacks is that theytake a PlanState pointer and a context pointer. Somebody figuredthey could save a couple lines of code by ignoring that, and passingExecShutdownNode itself as the walker even though it has but oneargument. Somewhat remarkably, we've gotten away with that so far.However, it seems clear that the upcoming C2x standard means toforbid such cases, and compilers that actively break such codelikely won't be far behind. So spend the extra few lines of codeto do it honestly with a separate walker function.In HEAD, we might as well go further and remove ExecShutdownNode'suseless return value. I left that as-is in back branches though,to forestall complaints about ABI breakage.Back-patch, with the thought that this might become of practicalimportance before our stable branches are all out of service.It doesn't seem to be fixing any live bug on any currently knownplatform, however.Discussion:https://postgr.es/m/208054.1663534665@sss.pgh.pa.us
1 parentb755811 commitc58513f

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

‎src/backend/executor/execProcnode.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@
119119

120120
staticTupleTableSlot*ExecProcNodeFirst(PlanState*node);
121121
staticTupleTableSlot*ExecProcNodeInstr(PlanState*node);
122+
staticboolExecShutdownNode_walker(PlanState*node,void*context);
122123

123124

124125
/* ------------------------------------------------------------------------
@@ -749,6 +750,12 @@ ExecEndNode(PlanState *node)
749750
*/
750751
bool
751752
ExecShutdownNode(PlanState*node)
753+
{
754+
returnExecShutdownNode_walker(node,NULL);
755+
}
756+
757+
staticbool
758+
ExecShutdownNode_walker(PlanState*node,void*context)
752759
{
753760
if (node==NULL)
754761
return false;
@@ -768,7 +775,7 @@ ExecShutdownNode(PlanState *node)
768775
if (node->instrument&&node->instrument->running)
769776
InstrStartNode(node->instrument);
770777

771-
planstate_tree_walker(node,ExecShutdownNode,NULL);
778+
planstate_tree_walker(node,ExecShutdownNode_walker,context);
772779

773780
switch (nodeTag(node))
774781
{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp