tests: Fix leak when checking for du binary
[glib.git] / glib / glist.h
blobaf35cd52cba5802898a48a2cdced04903ef81a62
1 /* GLIB - Library of useful routines for C programming
2 * Copyright (C) 1995-1997 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.1 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 #ifndef __G_LIST_H__
26 #define __G_LIST_H__
28 #if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
29 #error "Only <glib.h> can be included directly."
30 #endif
32 #include <glib/gmem.h>
33 #include <glib/gnode.h>
35 G_BEGIN_DECLS
37 typedef struct _GList GList;
39 struct _GList
41 gpointer data;
42 GList *next;
43 GList *prev;
46 /* Doubly linked lists
48 GLIB_AVAILABLE_IN_ALL
49 GList* g_list_alloc (void) G_GNUC_WARN_UNUSED_RESULT;
50 GLIB_AVAILABLE_IN_ALL
51 void g_list_free (GList *list);
52 GLIB_AVAILABLE_IN_ALL
53 void g_list_free_1 (GList *list);
54 #define g_list_free1 g_list_free_1
55 GLIB_AVAILABLE_IN_ALL
56 void g_list_free_full (GList *list,
57 GDestroyNotify free_func);
58 GLIB_AVAILABLE_IN_ALL
59 GList* g_list_append (GList *list,
60 gpointer data) G_GNUC_WARN_UNUSED_RESULT;
61 GLIB_AVAILABLE_IN_ALL
62 GList* g_list_prepend (GList *list,
63 gpointer data) G_GNUC_WARN_UNUSED_RESULT;
64 GLIB_AVAILABLE_IN_ALL
65 GList* g_list_insert (GList *list,
66 gpointer data,
67 gint position) G_GNUC_WARN_UNUSED_RESULT;
68 GLIB_AVAILABLE_IN_ALL
69 GList* g_list_insert_sorted (GList *list,
70 gpointer data,
71 GCompareFunc func) G_GNUC_WARN_UNUSED_RESULT;
72 GLIB_AVAILABLE_IN_ALL
73 GList* g_list_insert_sorted_with_data (GList *list,
74 gpointer data,
75 GCompareDataFunc func,
76 gpointer user_data) G_GNUC_WARN_UNUSED_RESULT;
77 GLIB_AVAILABLE_IN_ALL
78 GList* g_list_insert_before (GList *list,
79 GList *sibling,
80 gpointer data) G_GNUC_WARN_UNUSED_RESULT;
81 GLIB_AVAILABLE_IN_ALL
82 GList* g_list_concat (GList *list1,
83 GList *list2) G_GNUC_WARN_UNUSED_RESULT;
84 GLIB_AVAILABLE_IN_ALL
85 GList* g_list_remove (GList *list,
86 gconstpointer data) G_GNUC_WARN_UNUSED_RESULT;
87 GLIB_AVAILABLE_IN_ALL
88 GList* g_list_remove_all (GList *list,
89 gconstpointer data) G_GNUC_WARN_UNUSED_RESULT;
90 GLIB_AVAILABLE_IN_ALL
91 GList* g_list_remove_link (GList *list,
92 GList *llink) G_GNUC_WARN_UNUSED_RESULT;
93 GLIB_AVAILABLE_IN_ALL
94 GList* g_list_delete_link (GList *list,
95 GList *link_) G_GNUC_WARN_UNUSED_RESULT;
96 GLIB_AVAILABLE_IN_ALL
97 GList* g_list_reverse (GList *list) G_GNUC_WARN_UNUSED_RESULT;
98 GLIB_AVAILABLE_IN_ALL
99 GList* g_list_copy (GList *list) G_GNUC_WARN_UNUSED_RESULT;
101 GLIB_AVAILABLE_IN_2_34
102 GList* g_list_copy_deep (GList *list,
103 GCopyFunc func,
104 gpointer user_data) G_GNUC_WARN_UNUSED_RESULT;
106 GLIB_AVAILABLE_IN_ALL
107 GList* g_list_nth (GList *list,
108 guint n);
109 GLIB_AVAILABLE_IN_ALL
110 GList* g_list_nth_prev (GList *list,
111 guint n);
112 GLIB_AVAILABLE_IN_ALL
113 GList* g_list_find (GList *list,
114 gconstpointer data);
115 GLIB_AVAILABLE_IN_ALL
116 GList* g_list_find_custom (GList *list,
117 gconstpointer data,
118 GCompareFunc func);
119 GLIB_AVAILABLE_IN_ALL
120 gint g_list_position (GList *list,
121 GList *llink);
122 GLIB_AVAILABLE_IN_ALL
123 gint g_list_index (GList *list,
124 gconstpointer data);
125 GLIB_AVAILABLE_IN_ALL
126 GList* g_list_last (GList *list);
127 GLIB_AVAILABLE_IN_ALL
128 GList* g_list_first (GList *list);
129 GLIB_AVAILABLE_IN_ALL
130 guint g_list_length (GList *list);
131 GLIB_AVAILABLE_IN_ALL
132 void g_list_foreach (GList *list,
133 GFunc func,
134 gpointer user_data);
135 GLIB_AVAILABLE_IN_ALL
136 GList* g_list_sort (GList *list,
137 GCompareFunc compare_func) G_GNUC_WARN_UNUSED_RESULT;
138 GLIB_AVAILABLE_IN_ALL
139 GList* g_list_sort_with_data (GList *list,
140 GCompareDataFunc compare_func,
141 gpointer user_data) G_GNUC_WARN_UNUSED_RESULT;
142 GLIB_AVAILABLE_IN_ALL
143 gpointer g_list_nth_data (GList *list,
144 guint n);
147 #define g_list_previous(list) ((list) ? (((GList *)(list))->prev) : NULL)
148 #define g_list_next(list) ((list) ? (((GList *)(list))->next) : NULL)
150 G_END_DECLS
152 #endif /* __G_LIST_H__ */