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 <!-- ##### SECTION Stability_Level ##### -->
27 <!-- ##### STRUCT GTrashStack ##### -->
29 Each piece of memory that is pushed onto the stack
30 is cast to a <structname>GTrashStack*</structname>.
33 @next: pointer to the previous element of the stack,
34 gets stored in the first <literal>sizeof (gpointer)</literal>
37 <!-- ##### FUNCTION g_trash_stack_push ##### -->
39 Pushes a piece of memory onto a #GTrashStack.
42 @stack_p: a pointer to a #GTrashStack.
43 @data_p: the piece of memory to push on the stack.
46 <!-- ##### FUNCTION g_trash_stack_pop ##### -->
48 Pops a piece of memory off a #GTrashStack.
51 @stack_p: a pointer to a #GTrashStack.
52 @Returns: the element at the top of the stack.
55 <!-- ##### FUNCTION g_trash_stack_peek ##### -->
57 Returns the element at the top of a #GTrashStack.
60 @stack_p: a pointer to a #GTrashStack.
61 @Returns: the element at the top of the stack.
64 <!-- ##### FUNCTION g_trash_stack_height ##### -->
66 Returns the height of a #GTrashStack.
69 @stack_p: a pointer to a #GTrashStack.
70 @Returns: the height of the stack.