Elektra  0.8.19
Functions

The requirements are described in doc/help/elektra-data-structures.md. More...

Collaboration diagram for Vstack:

Functions

Vstack * elektraVstackInit (size_t minSize)
 Allocates vstack with size specified by parameter minSize and sets the stack pointer. More...
 
int elektraVstackPush (Vstack *stack, void *data)
 Pushes an element in the Vstack and resizes the stack if needed. More...
 
void * elektraVstackPop (Vstack *stack)
 Pops an element from the Vstack and resizes the stack if needed. More...
 
int elektraVstackIsEmpty (const Vstack *stack)
 Checks if the stack is empty. More...
 
void elektraVstackDel (Vstack *stack)
 Deletes the stack, by freeing all memory.
 
int elektraVstackClear (Vstack *stack)
 Clears the stack in a fast fashion. More...
 

Detailed Description

The requirements are described in doc/help/elektra-data-structures.md.

The Vstack structure.

A stack implementation with dynamical memory allocation. The space gets doubled if full and reduced by half if used only a quarter of it, but not less than minSize.

Function Documentation

int elektraVstackClear ( Vstack *  stack)

Clears the stack in a fast fashion.

Resets the stackpointer to the base and does not reallocate memory. The next reallocation happens at Pop.

Return values
1on success
0on error
Vstack* elektraVstackInit ( size_t  minSize)

Allocates vstack with size specified by parameter minSize and sets the stack pointer.

Parameters
minSizethe minimum size of the stack
Return values
aVstack pointer
NULLerror
int elektraVstackIsEmpty ( const Vstack *  stack)

Checks if the stack is empty.

Return values
1on empty
0on non empty
-1on error
void* elektraVstackPop ( Vstack *  stack)

Pops an element from the Vstack and resizes the stack if needed.

Return values
theelement
NULLon empty
int elektraVstackPush ( Vstack *  stack,
void *  data 
)

Pushes an element in the Vstack and resizes the stack if needed.

Parameters
datathe element
Return values
0on error
1otherwise