gslist.h 5.46 KB
Newer Older
1 2 3 4 5 6
/* GLIB - Library of useful routines for C programming
 * Copyright (C) 1995-1997  Peter Mattis, Spencer Kimball and Josh MacDonald
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
7
 * version 2.1 of the License, or (at your option) any later version.
8 9 10 11 12 13 14
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
 * Lesser General Public License for more details.
 *
 * 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/>.
16 17 18 19 20 21
 */

/*
 * Modified by the GLib Team and others 1997-2000.  See the AUTHORS
 * file for a list of people on the GLib Team.  See the ChangeLog
 * files for a list of changes.  These files are distributed with
22
 * GLib at ftp://ftp.gtk.org/pub/gtk/.
23 24
 */

25 26 27
#ifndef __G_SLIST_H__
#define __G_SLIST_H__

28
#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
29 30 31
#error "Only <glib.h> can be included directly."
#endif

32
#include <glib/gmem.h>
33
#include <glib/gnode.h>
34 35 36

G_BEGIN_DECLS

37
typedef struct _GSList GSList;
38 39 40 41 42 43 44 45 46

struct _GSList
{
  gpointer data;
  GSList *next;
};

/* 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 53
void     g_slist_free_1                  (GSList           *list);
#define	 g_slist_free1		         g_slist_free_1
54
GLIB_AVAILABLE_IN_ALL
55 56
void     g_slist_free_full               (GSList           *list,
					  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 65
GSList*  g_slist_insert                  (GSList           *list,
					  gpointer          data,
66
					  gint              position) G_GNUC_WARN_UNUSED_RESULT;
67
GLIB_AVAILABLE_IN_ALL
68 69
GSList*  g_slist_insert_sorted           (GSList           *list,
					  gpointer          data,
70
					  GCompareFunc      func) G_GNUC_WARN_UNUSED_RESULT;
71
GLIB_AVAILABLE_IN_ALL
72 73 74
GSList*  g_slist_insert_sorted_with_data (GSList           *list,
					  gpointer          data,
					  GCompareDataFunc  func,
75
					  gpointer          user_data) G_GNUC_WARN_UNUSED_RESULT;
76
GLIB_AVAILABLE_IN_ALL
77 78
GSList*  g_slist_insert_before           (GSList           *slist,
					  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;
99 100 101 102 103

GLIB_AVAILABLE_IN_2_34
GSList*  g_slist_copy_deep               (GSList            *list,
					  GCopyFunc         func,
					  gpointer          user_data) G_GNUC_WARN_UNUSED_RESULT;
104
GLIB_AVAILABLE_IN_ALL
105 106
GSList*  g_slist_nth                     (GSList           *list,
					  guint             n);
107
GLIB_AVAILABLE_IN_ALL
108 109
GSList*  g_slist_find                    (GSList           *list,
					  gconstpointer     data);
110
GLIB_AVAILABLE_IN_ALL
111 112 113
GSList*  g_slist_find_custom             (GSList           *list,
					  gconstpointer     data,
					  GCompareFunc      func);
114
GLIB_AVAILABLE_IN_ALL
115 116
gint     g_slist_position                (GSList           *list,
					  GSList           *llink);
117
GLIB_AVAILABLE_IN_ALL
118 119
gint     g_slist_index                   (GSList           *list,
					  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 126 127
void     g_slist_foreach                 (GSList           *list,
					  GFunc             func,
					  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 133
GSList*  g_slist_sort_with_data          (GSList           *list,
					  GCompareDataFunc  compare_func,
134
					  gpointer          user_data) G_GNUC_WARN_UNUSED_RESULT;
135
GLIB_AVAILABLE_IN_ALL
136 137 138 139
gpointer g_slist_nth_data                (GSList           *list,
					  guint             n);

#define  g_slist_next(slist)	         ((slist) ? (((GSList *)(slist))->next) : NULL)
140 141 142 143

G_END_DECLS

#endif /* __G_SLIST_H__ */