Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f608c36

Browse files
committed
Use puttuple_common function from vanilla tuplesort
1 parent 4b3b24e commit f608c36

File tree

1 file changed

+4
-22
lines changed

1 file changed

+4
-22
lines changed

src/rumsort.c

+4-22
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ static int comparetup_rumitem(const SortTuple *a, const SortTuple *b,
6565
static void copytup_rum(RumTuplesortstate * state, SortTuple *stup, void *tup);
6666
static void copytup_rumitem(RumTuplesortstate * state, SortTuple *stup, void *tup);
6767
static void *rum_tuplesort_getrum_internal(RumTuplesortstate * state, bool forward, bool *should_free);
68-
static void rum_tuplesort_putrum_internal(RumTuplesortstate * state, void *item);
6968

7069
static int
7170
compare_rum_itempointer(ItemPointerData p1, ItemPointerData p2)
@@ -370,33 +369,16 @@ rum_tuplesort_get_memorycontext(RumTuplesortstate * state)
370369
return state->sortcontext;
371370
}
372371

373-
static void
374-
rum_tuplesort_putrum_internal(RumTuplesortstate * state, void *item)
375-
{
376-
MemoryContext oldcontext = MemoryContextSwitchTo(state->sortcontext);
377-
SortTuple stup;
378-
379-
/*
380-
* Copy the given tuple into memory we control, and decrease availMem.
381-
* Then call the common code.
382-
*/
383-
COPYTUP(state, &stup, item);
384-
385-
puttuple_common(state, &stup);
386-
387-
MemoryContextSwitchTo(oldcontext);
388-
}
389-
390372
void
391-
rum_tuplesort_putrum(RumTuplesortstate * state, RumSortItem * item)
373+
rum_tuplesort_putrum(RumTuplesortstate *state, RumSortItem *item)
392374
{
393-
rum_tuplesort_putrum_internal(state, item);
375+
tuplesort_puttupleslot(state, (TupleTableSlot *) item);
394376
}
395377

396378
void
397-
rum_tuplesort_putrumitem(RumTuplesortstate * state, RumScanItem * item)
379+
rum_tuplesort_putrumitem(RumTuplesortstate *state, RumScanItem *item)
398380
{
399-
rum_tuplesort_putrum_internal(state, item);
381+
tuplesort_puttupleslot(state, (TupleTableSlot *) item);
400382
}
401383

402384
void

0 commit comments

Comments
 (0)