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/gininsert.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'src/backend/access/gin/gininsert.c') diff --git a/src/backend/access/gin/gininsert.c b/src/backend/access/gin/gininsert.c index cd9c7c120b3..3bafb6471b3 100644 --- a/src/backend/access/gin/gininsert.c +++ b/src/backend/access/gin/gininsert.c @@ -67,12 +67,9 @@ addItemPointersToLeafTuple(GinState *ginstate, /* merge the old and new posting lists */ oldItems = ginReadTuple(ginstate, attnum, old, &oldNPosting); - newNPosting = oldNPosting + nitem; - newItems = (ItemPointerData *) palloc(sizeof(ItemPointerData) * newNPosting); - - newNPosting = ginMergeItemPointers(newItems, - items, nitem, - oldItems, oldNPosting); + newItems = ginMergeItemPointers(items, nitem, + oldItems, oldNPosting, + &newNPosting); /* Compress the posting list, and try to a build tuple with room for it */ res = NULL; -- cgit v1.2.3