src/libs/elektra/opmphm_vstack.c
/**
 * Allocates vstack with size specified by parameter minSize and sets the stack pointer.
 *
 * @ingroup vstack
 * @param minSize the minimum size of the stack
 * @retval a Vstack pointer
 * @retval NULL error
 */
Allocates vstack with size specified by parameter minSize and sets the stack pointer.
@ingroup vstack
@param minSize the minimum size of the stack
@retval a Vstack pointer
@retval NULL error
Allocates vstack with size specified by parameter minSize and sets the stack pointer . @ingroup vstack @param minSize the minimum size of the stack @retval a Vstack pointer @retval NULL error
Vstack * elektraVstackInit (size_t minSize)
{
	if (minSize < 1) return NULL;
	Vstack * newStack = elektraMalloc (sizeof (Vstack));
	if (!newStack) return NULL;
	newStack->size = minSize;
	newStack->minSize = minSize;
	ELEKTRA_LOG_DEBUG ("VSTACK MALLOC TO = %zu", newStack->size);
	newStack->data = elektraMalloc (newStack->size * sizeof (void *));
	if (!newStack->data)
	{
		elektraFree (newStack);
		return NULL;
	}
	newStack->head = newStack->data;
	return newStack;
}
Vstack * elektraVstackInit ( size_t minSize ) { if ( minSize < 1 ) return NULL ; Vstack * newStack = elektraMalloc ( sizeof ( Vstack ) ) ; if ( ! newStack ) return NULL ; newStack -> size = minSize ; newStack -> minSize = minSize ; ELEKTRA_LOG_DEBUG ( " " , newStack -> size ) ; newStack -> data = elektraMalloc ( newStack -> size * sizeof ( void * ) ) ; if ( ! newStack -> data ) { elektraFree ( newStack ) ; return NULL ; } newStack -> head = newStack -> data ; return newStack ; }
Allocates vstack with size specified by parameter minSize and sets the stack pointer.
Allocates vstack with size specified by parameter minSize and sets the stack pointer .