1 <!-- ##### SECTION Title ##### -->
4 <!-- ##### SECTION Short_Description ##### -->
5 maintain a stack of unused allocated memory chunks.
7 <!-- ##### SECTION Long_Description ##### -->
9 A #GTrashStack is an efficient way to keep a stack of unused allocated
10 memory chunks. Each memory chunk is required to be large enough to hold
11 a #gpointer. This allows the stack to be maintained without any space
12 overhead, since the stack pointers can be stored inside the memory chunks.
15 There is no function to create a #GTrashStack. A %NULL #GTrashStack*
16 is a perfectly valid empty stack.
19 <!-- ##### SECTION See_Also ##### -->
24 <!-- ##### STRUCT GTrashStack ##### -->
26 Each piece of memory that is pushed onto the stack
27 is cast to a <structname>GTrashStack*</structname>.
30 @next: pointer to the previous element of the stack,
31 gets stored in the first <literal>sizeof (gpointer)</literal>
34 <!-- ##### FUNCTION g_trash_stack_push ##### -->
36 Pushes a piece of memory onto a #GTrashStack.
39 @stack_p: a pointer to a #GTrashStack.
40 @data_p: the piece of memory to push on the stack.
43 <!-- ##### FUNCTION g_trash_stack_pop ##### -->
45 Pops a piece of memory off a #GTrashStack.
48 @stack_p: a pointer to a #GTrashStack.
49 @Returns: the element at the top of the stack.
52 <!-- ##### FUNCTION g_trash_stack_peek ##### -->
54 Returns the element at the top of a #GTrashStack.
57 @stack_p: a pointer to a #GTrashStack.
58 @Returns: the element at the top of the stack.
61 <!-- ##### FUNCTION g_trash_stack_height ##### -->
63 Returns the height of a #GTrashStack.
66 @stack_p: a pointer to a #GTrashStack.
67 @Returns: the height of the stack.