diff options
author | Tom Lane | 2017-03-12 19:52:50 +0000 |
---|---|---|
committer | Tom Lane | 2017-03-12 19:52:50 +0000 |
commit | 5d3f7c57ab9c9e2f074ad29d619056570fc5c51e (patch) | |
tree | 5d568241c4b4372ee029a2dc3ac6ddff7a328bb0 /src/backend/executor/nodeGatherMerge.c | |
parent | ce38949ba23ab311f274aa4196be09d18d30e5a6 (diff) |
Remove dead code in nodeGatherMerge.c.
Coverity noted that the last line of gather_merge_getnext() was
unreachable, since each arm of the preceding "if" ends in a "return".
Drop it as an oversight. In passing, improve some nearby comments.
Diffstat (limited to 'src/backend/executor/nodeGatherMerge.c')
-rw-r--r-- | src/backend/executor/nodeGatherMerge.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/src/backend/executor/nodeGatherMerge.c b/src/backend/executor/nodeGatherMerge.c index 62a6b1866dc..72f30ab4e6b 100644 --- a/src/backend/executor/nodeGatherMerge.c +++ b/src/backend/executor/nodeGatherMerge.c @@ -423,8 +423,8 @@ reread: } /* - * Clear out a slot in the tuple table for each gather merge - * slot and return the clear cleared slot. + * Clear out the tuple table slots for each gather merge input, + * and return a cleared slot. */ static TupleTableSlot * gather_merge_clear_slots(GatherMergeState *gm_state) @@ -456,19 +456,21 @@ gather_merge_getnext(GatherMergeState *gm_state) { int i; - /* - * First time through: pull the first tuple from each participate, and set - * up the heap. - */ - if (gm_state->gm_initialized == false) + if (!gm_state->gm_initialized) + { + /* + * First time through: pull the first tuple from each participant, and + * set up the heap. + */ gather_merge_init(gm_state); + } else { /* * Otherwise, pull the next tuple from whichever participant we - * returned from last time, and reinsert the index into the heap, - * because it might now compare differently against the existing - * elements of the heap. + * returned from last time, and reinsert that participant's index into + * the heap, because it might now compare differently against the + * other elements of the heap. */ i = DatumGetInt32(binaryheap_first(gm_state->gm_heap)); @@ -485,11 +487,10 @@ gather_merge_getnext(GatherMergeState *gm_state) } else { + /* Return next tuple from whichever participant has the leading one */ i = DatumGetInt32(binaryheap_first(gm_state->gm_heap)); return gm_state->gm_slots[i]; } - - return gather_merge_clear_slots(gm_state); } /* |