src/backend/replication/logical/reorderbuffer.c
static ReorderBufferTXN *
ReorderBufferGetTXN(ReorderBuffer *rb)
{
	ReorderBufferTXN *txn;

	/* check the slab cache */
	if (rb->nr_cached_transactions > 0)
	{
		rb->nr_cached_transactions--;
		txn = (ReorderBufferTXN *)
			dlist_container(ReorderBufferTXN, node,
							dlist_pop_head_node(&rb->cached_transactions));
	}
	else
	{
		txn = (ReorderBufferTXN *)
			MemoryContextAlloc(rb->context, sizeof(ReorderBufferTXN));
	}

	memset(txn, 0, sizeof(ReorderBufferTXN));

	dlist_init(&txn->changes);
	dlist_init(&txn->tuplecids);
	dlist_init(&txn->subtxns);

	return txn;
}
/*
 * Get an unused, possibly preallocated, ReorderBufferTXN.
 */
Get an unused, possibly preallocated, ReorderBufferTXN.
Get an unused possibly preallocated ReorderBufferTXN .
static ReorderBufferTXN *
ReorderBufferGetTXN(ReorderBuffer *rb)
{
	ReorderBufferTXN *txn;
	if (rb->nr_cached_transactions > 0)
	{
		rb->nr_cached_transactions--;
		txn = (ReorderBufferTXN *)
			dlist_container(ReorderBufferTXN, node,
							dlist_pop_head_node(&rb->cached_transactions));
	}
	else
	{
		txn = (ReorderBufferTXN *)
			MemoryContextAlloc(rb->context, sizeof(ReorderBufferTXN));
	}
	memset(txn, 0, sizeof(ReorderBufferTXN));
	dlist_init(&txn->changes);
	dlist_init(&txn->tuplecids);
	dlist_init(&txn->subtxns);
	return txn;
}
static ReorderBufferTXN * ReorderBufferGetTXN ( ReorderBuffer * rb ) { ReorderBufferTXN * txn ; if ( rb -> nr_cached_transactions > 0 ) { rb -> nr_cached_transactions -- ; txn = ( ReorderBufferTXN * ) dlist_container ( ReorderBufferTXN , node , dlist_pop_head_node ( & rb -> cached_transactions ) ) ; } else { txn = ( ReorderBufferTXN * ) MemoryContextAlloc ( rb -> context , sizeof ( ReorderBufferTXN ) ) ; } memset ( txn , 0 , sizeof ( ReorderBufferTXN ) ) ; dlist_init ( & txn -> changes ) ; dlist_init ( & txn -> tuplecids ) ; dlist_init ( & txn -> subtxns ) ; return txn ; }
Get an unused, possibly preallocated, ReorderBufferTXN.
Get an unused possibly preallocated ReorderBufferTXN .
/* check the slab cache */