src/backend/utils/sort/logtape.c
/*
 * Return a block# to the freelist.
 */
Return a block# to the freelist.
Return a block# to the freelist .
static void
ltsReleaseBlock(LogicalTapeSet *lts, long blocknum)
{
	int			ndx;
	if (lts->forgetFreeSpace)
		return;
	if (lts->nFreeBlocks >= lts->freeBlocksLen)
	{
		lts->freeBlocksLen *= 2;
		lts->freeBlocks = (long *) repalloc(lts->freeBlocks,
										  lts->freeBlocksLen * sizeof(long));
	}
	ndx = lts->nFreeBlocks++;
	lts->freeBlocks[ndx] = blocknum;
	if (ndx > 0 && lts->freeBlocks[ndx - 1] < blocknum)
		lts->blocksSorted = false;
}
static void ltsReleaseBlock ( LogicalTapeSet * lts , long blocknum ) { int ndx ; if ( lts -> forgetFreeSpace ) return ; if ( lts -> nFreeBlocks >= lts -> freeBlocksLen ) { lts -> freeBlocksLen *= 2 ; lts -> freeBlocks = ( long * ) repalloc ( lts -> freeBlocks , lts -> freeBlocksLen * sizeof ( long ) ) ; } ndx = lts -> nFreeBlocks ++ ; lts -> freeBlocks [ ndx ] = blocknum ; if ( ndx > 0 && lts -> freeBlocks [ ndx - 1 ] < blocknum ) lts -> blocksSorted = false ; }
Return a block# to the freelist.
Return a block# to the freelist .
/*
	 * Do nothing if we're no longer interested in remembering free space.
	 */ /*
	 * Enlarge freeBlocks array if full.
	 */ /*
	 * Add blocknum to array, and mark the array unsorted if it's no longer in
	 * decreasing order.
	 */