Merge branch 'test-ip_mreq_source-android-only' into 'master'
[glib.git] / glib / gslist.h
blob2704ef7d35ad5a4a08b90c8612f59a168282961c
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_SLIST_H__
26 #define __G_SLIST_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 _GSList GSList;
39 struct _GSList
41 gpointer data;
42 GSList *next;
45 /* Singly linked lists
47 GLIB_AVAILABLE_IN_ALL
48 GSList* g_slist_alloc (void) G_GNUC_WARN_UNUSED_RESULT;
49 GLIB_AVAILABLE_IN_ALL
50 void g_slist_free (GSList *list);
51 GLIB_AVAILABLE_IN_ALL
52 void g_slist_free_1 (GSList *list);
53 #define g_slist_free1 g_slist_free_1
54 GLIB_AVAILABLE_IN_ALL
55 void g_slist_free_full (GSList *list,
56 GDestroyNotify free_func);
57 GLIB_AVAILABLE_IN_ALL
58 GSList* g_slist_append (GSList *list,
59 gpointer data) G_GNUC_WARN_UNUSED_RESULT;
60 GLIB_AVAILABLE_IN_ALL
61 GSList* g_slist_prepend (GSList *list,
62 gpointer data) G_GNUC_WARN_UNUSED_RESULT;
63 GLIB_AVAILABLE_IN_ALL
64 GSList* g_slist_insert (GSList *list,
65 gpointer data,
66 gint position) G_GNUC_WARN_UNUSED_RESULT;
67 GLIB_AVAILABLE_IN_ALL
68 GSList* g_slist_insert_sorted (GSList *list,
69 gpointer data,
70 GCompareFunc func) G_GNUC_WARN_UNUSED_RESULT;
71 GLIB_AVAILABLE_IN_ALL
72 GSList* g_slist_insert_sorted_with_data (GSList *list,
73 gpointer data,
74 GCompareDataFunc func,
75 gpointer user_data) G_GNUC_WARN_UNUSED_RESULT;
76 GLIB_AVAILABLE_IN_ALL
77 GSList* g_slist_insert_before (GSList *slist,
78 GSList *sibling,
79 gpointer data) G_GNUC_WARN_UNUSED_RESULT;
80 GLIB_AVAILABLE_IN_ALL
81 GSList* g_slist_concat (GSList *list1,
82 GSList *list2) G_GNUC_WARN_UNUSED_RESULT;
83 GLIB_AVAILABLE_IN_ALL
84 GSList* g_slist_remove (GSList *list,
85 gconstpointer data) G_GNUC_WARN_UNUSED_RESULT;
86 GLIB_AVAILABLE_IN_ALL
87 GSList* g_slist_remove_all (GSList *list,
88 gconstpointer data) G_GNUC_WARN_UNUSED_RESULT;
89 GLIB_AVAILABLE_IN_ALL
90 GSList* g_slist_remove_link (GSList *list,
91 GSList *link_) G_GNUC_WARN_UNUSED_RESULT;
92 GLIB_AVAILABLE_IN_ALL
93 GSList* g_slist_delete_link (GSList *list,
94 GSList *link_) G_GNUC_WARN_UNUSED_RESULT;
95 GLIB_AVAILABLE_IN_ALL
96 GSList* g_slist_reverse (GSList *list) G_GNUC_WARN_UNUSED_RESULT;
97 GLIB_AVAILABLE_IN_ALL
98 GSList* g_slist_copy (GSList *list) G_GNUC_WARN_UNUSED_RESULT;
100 GLIB_AVAILABLE_IN_2_34
101 GSList* g_slist_copy_deep (GSList *list,
102 GCopyFunc func,
103 gpointer user_data) G_GNUC_WARN_UNUSED_RESULT;
104 GLIB_AVAILABLE_IN_ALL
105 GSList* g_slist_nth (GSList *list,
106 guint n);
107 GLIB_AVAILABLE_IN_ALL
108 GSList* g_slist_find (GSList *list,
109 gconstpointer data);
110 GLIB_AVAILABLE_IN_ALL
111 GSList* g_slist_find_custom (GSList *list,
112 gconstpointer data,
113 GCompareFunc func);
114 GLIB_AVAILABLE_IN_ALL
115 gint g_slist_position (GSList *list,
116 GSList *llink);
117 GLIB_AVAILABLE_IN_ALL
118 gint g_slist_index (GSList *list,
119 gconstpointer data);
120 GLIB_AVAILABLE_IN_ALL
121 GSList* g_slist_last (GSList *list);
122 GLIB_AVAILABLE_IN_ALL
123 guint g_slist_length (GSList *list);
124 GLIB_AVAILABLE_IN_ALL
125 void g_slist_foreach (GSList *list,
126 GFunc func,
127 gpointer user_data);
128 GLIB_AVAILABLE_IN_ALL
129 GSList* g_slist_sort (GSList *list,
130 GCompareFunc compare_func) G_GNUC_WARN_UNUSED_RESULT;
131 GLIB_AVAILABLE_IN_ALL
132 GSList* g_slist_sort_with_data (GSList *list,
133 GCompareDataFunc compare_func,
134 gpointer user_data) G_GNUC_WARN_UNUSED_RESULT;
135 GLIB_AVAILABLE_IN_ALL
136 gpointer g_slist_nth_data (GSList *list,
137 guint n);
139 #define g_slist_next(slist) ((slist) ? (((GSList *)(slist))->next) : NULL)
141 G_END_DECLS
143 #endif /* __G_SLIST_H__ */