TrashStack

A GTrashStack is an efficient way to keep a stack of unused allocated memory chunks. Each memory chunk is required to be large enough to hold a gpointer. This allows the stack to be maintained without any space overhead, since the stack pointers can be stored inside the memory chunks.

There is no function to create a GTrashStack. A NULL GTrashStack* is a perfectly valid empty stack.

Constructors

this
this(GTrashStack* gTrashStack)

Sets our main struct and passes it to the parent class

Members

Functions

getStruct
void* getStruct()

the main Gtk struct as a void*

getTrashStackStruct
GTrashStack* getTrashStackStruct()

Get the main Gtk struct

Static functions

height
uint height(GTrashStack** stackP)

Returns the height of a GTrashStack. Note that execution of this function is of O(N) complexity where N denotes the number of items on the stack.

peek
void* peek(GTrashStack** stackP)

Returns the element at the top of a GTrashStack which may be NULL.

pop
void* pop(GTrashStack** stackP)

Pops a piece of memory off a GTrashStack.

push
void push(GTrashStack** stackP, void* dataP)

Pushes a piece of memory onto a GTrashStack.

Variables

gTrashStack
GTrashStack* gTrashStack;

the main Gtk struct

Meta