From bb42e21be274a71f6868ce2fc8fae2c15c3ecf66 Mon Sep 17 00:00:00 2001 From: Heikki Linnakangas Date: Mon, 24 Mar 2014 18:40:26 +0200 Subject: Change ginMergeItemPointers to return a palloc'd array. That seems nicer than making it the caller's responsibility to pass a suitable-sized array. All the callers were just palloc'ing an array anyway. --- src/backend/access/gin/gindatapage.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/backend/access/gin/gindatapage.c') diff --git a/src/backend/access/gin/gindatapage.c b/src/backend/access/gin/gindatapage.c index c6230f3bc5a..313d53c354f 100644 --- a/src/backend/access/gin/gindatapage.c +++ b/src/backend/access/gin/gindatapage.c @@ -1303,10 +1303,9 @@ addItemsToLeaf(disassembledLeaf *leaf, ItemPointer newItems, int nNewItems) if (!cur->items) cur->items = ginPostingListDecode(cur->seg, &cur->nitems); - tmpitems = palloc((cur->nitems + nthis) * sizeof(ItemPointerData)); - ntmpitems = ginMergeItemPointers(tmpitems, - cur->items, cur->nitems, - nextnew, nthis); + tmpitems = ginMergeItemPointers(cur->items, cur->nitems, + nextnew, nthis, + &ntmpitems); if (ntmpitems != cur->nitems) { cur->items = tmpitems; -- cgit v1.2.3