Updated Hungarian translation
[glib.git] / glib / gtrashstack.c
blob896ed6f6d3e1e282821867a37e114eac87e60f85
1 /* GLIB - Library of useful routines for C programming
2 * Copyright (C) 1995-1998 Peter Mattis, Spencer Kimball and Josh MacDonald
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
19 * Modified by the GLib Team and others 1997-2000. See the AUTHORS
20 * file for a list of people on the GLib Team. See the ChangeLog
21 * files for a list of changes. These files are distributed with
22 * GLib at ftp://ftp.gtk.org/pub/gtk/.
25 #include "config.h"
27 /**
28 * SECTION:trash_stack
29 * @title: Trash Stacks
30 * @short_description: maintain a stack of unused allocated memory chunks
32 * A #GTrashStack is an efficient way to keep a stack of unused allocated
33 * memory chunks. Each memory chunk is required to be large enough to hold
34 * a #gpointer. This allows the stack to be maintained without any space
35 * overhead, since the stack pointers can be stored inside the memory chunks.
37 * There is no function to create a #GTrashStack. A %NULL #GTrashStack*
38 * is a perfectly valid empty stack.
41 /**
42 * GTrashStack:
43 * @next: pointer to the previous element of the stack,
44 * gets stored in the first `sizeof (gpointer)`
45 * bytes of the element
47 * Each piece of memory that is pushed onto the stack
48 * is cast to a GTrashStack*.
51 /**
52 * g_trash_stack_push:
53 * @stack_p: a #GTrashStack
54 * @data_p: the piece of memory to push on the stack
56 * Pushes a piece of memory onto a #GTrashStack.
59 /**
60 * g_trash_stack_pop:
61 * @stack_p: a #GTrashStack
63 * Pops a piece of memory off a #GTrashStack.
65 * Returns: the element at the top of the stack
68 /**
69 * g_trash_stack_peek:
70 * @stack_p: a #GTrashStack
72 * Returns the element at the top of a #GTrashStack
73 * which may be %NULL.
75 * Returns: the element at the top of the stack
78 /**
79 * g_trash_stack_height:
80 * @stack_p: a #GTrashStack
82 * Returns the height of a #GTrashStack.
84 * Note that execution of this function is of O(N) complexity
85 * where N denotes the number of items on the stack.
87 * Returns: the height of the stack
90 #define G_IMPLEMENT_INLINES 1
91 #define __G_TRASH_STACK_C__
92 #include "gtrashstack.h"