GApplication: Make ::startup run-first
[glib.git] / glib / gtrashstack.c
blob71eca13e5d419d9a328ae9214af481d34519c91e
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, write to the
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
21 * Modified by the GLib Team and others 1997-2000. See the AUTHORS
22 * file for a list of people on the GLib Team. See the ChangeLog
23 * files for a list of changes. These files are distributed with
24 * GLib at ftp://ftp.gtk.org/pub/gtk/.
27 #include "config.h"
29 /**
30 * SECTION:trash_stack
31 * @title: Trash Stacks
32 * @short_description: maintain a stack of unused allocated memory chunks
34 * A #GTrashStack is an efficient way to keep a stack of unused allocated
35 * memory chunks. Each memory chunk is required to be large enough to hold
36 * a #gpointer. This allows the stack to be maintained without any space
37 * overhead, since the stack pointers can be stored inside the memory chunks.
39 * There is no function to create a #GTrashStack. A %NULL #GTrashStack*
40 * is a perfectly valid empty stack.
43 /**
44 * GTrashStack:
45 * @next: pointer to the previous element of the stack,
46 * gets stored in the first <literal>sizeof (gpointer)</literal>
47 * bytes of the element
49 * Each piece of memory that is pushed onto the stack
50 * is cast to a <structname>GTrashStack*</structname>.
53 /**
54 * g_trash_stack_push:
55 * @stack_p: a #GTrashStack
56 * @data_p: the piece of memory to push on the stack
58 * Pushes a piece of memory onto a #GTrashStack.
61 /**
62 * g_trash_stack_pop:
63 * @stack_p: a #GTrashStack
65 * Pops a piece of memory off a #GTrashStack.
67 * Returns: the element at the top of the stack
70 /**
71 * g_trash_stack_peek:
72 * @stack_p: a #GTrashStack
74 * Returns the element at the top of a #GTrashStack
75 * which may be %NULL.
77 * Returns: the element at the top of the stack
80 /**
81 * g_trash_stack_height:
82 * @stack_p: a #GTrashStack
84 * Returns the height of a #GTrashStack.
86 * Note that execution of this function is of O(N) complexity
87 * where N denotes the number of items on the stack.
89 * Returns: the height of the stack
92 #define G_IMPLEMENT_INLINES 1
93 #define __G_TRASH_STACK_C__
94 #include "gtrashstack.h"