File indexing completed on 2025-12-21 09:54:07
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027 #ifndef __G_SLIST_H__
0028 #define __G_SLIST_H__
0029
0030 #if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
0031 #error "Only <glib.h> can be included directly."
0032 #endif
0033
0034 #include <glib/gmem.h>
0035 #include <glib/gnode.h>
0036
0037 G_BEGIN_DECLS
0038
0039 typedef struct _GSList GSList;
0040
0041 struct _GSList
0042 {
0043 gpointer data;
0044 GSList *next;
0045 };
0046
0047
0048
0049 GLIB_AVAILABLE_IN_ALL
0050 GSList* g_slist_alloc (void) G_GNUC_WARN_UNUSED_RESULT;
0051 GLIB_AVAILABLE_IN_ALL
0052 void g_slist_free (GSList *list);
0053 GLIB_AVAILABLE_IN_ALL
0054 void g_slist_free_1 (GSList *list);
0055 #define g_slist_free1 g_slist_free_1
0056 GLIB_AVAILABLE_IN_ALL
0057 void g_slist_free_full (GSList *list,
0058 GDestroyNotify free_func);
0059 GLIB_AVAILABLE_IN_ALL
0060 GSList* g_slist_append (GSList *list,
0061 gpointer data) G_GNUC_WARN_UNUSED_RESULT;
0062 GLIB_AVAILABLE_IN_ALL
0063 GSList* g_slist_prepend (GSList *list,
0064 gpointer data) G_GNUC_WARN_UNUSED_RESULT;
0065 GLIB_AVAILABLE_IN_ALL
0066 GSList* g_slist_insert (GSList *list,
0067 gpointer data,
0068 gint position) G_GNUC_WARN_UNUSED_RESULT;
0069 GLIB_AVAILABLE_IN_ALL
0070 GSList* g_slist_insert_sorted (GSList *list,
0071 gpointer data,
0072 GCompareFunc func) G_GNUC_WARN_UNUSED_RESULT;
0073 GLIB_AVAILABLE_IN_ALL
0074 GSList* g_slist_insert_sorted_with_data (GSList *list,
0075 gpointer data,
0076 GCompareDataFunc func,
0077 gpointer user_data) G_GNUC_WARN_UNUSED_RESULT;
0078 GLIB_AVAILABLE_IN_ALL
0079 GSList* g_slist_insert_before (GSList *slist,
0080 GSList *sibling,
0081 gpointer data) G_GNUC_WARN_UNUSED_RESULT;
0082 GLIB_AVAILABLE_IN_ALL
0083 GSList* g_slist_concat (GSList *list1,
0084 GSList *list2) G_GNUC_WARN_UNUSED_RESULT;
0085 GLIB_AVAILABLE_IN_ALL
0086 GSList* g_slist_remove (GSList *list,
0087 gconstpointer data) G_GNUC_WARN_UNUSED_RESULT;
0088 GLIB_AVAILABLE_IN_ALL
0089 GSList* g_slist_remove_all (GSList *list,
0090 gconstpointer data) G_GNUC_WARN_UNUSED_RESULT;
0091 GLIB_AVAILABLE_IN_ALL
0092 GSList* g_slist_remove_link (GSList *list,
0093 GSList *link_) G_GNUC_WARN_UNUSED_RESULT;
0094 GLIB_AVAILABLE_IN_ALL
0095 GSList* g_slist_delete_link (GSList *list,
0096 GSList *link_) G_GNUC_WARN_UNUSED_RESULT;
0097 GLIB_AVAILABLE_IN_ALL
0098 GSList* g_slist_reverse (GSList *list) G_GNUC_WARN_UNUSED_RESULT;
0099 GLIB_AVAILABLE_IN_ALL
0100 GSList* g_slist_copy (GSList *list) G_GNUC_WARN_UNUSED_RESULT;
0101
0102 GLIB_AVAILABLE_IN_2_34
0103 GSList* g_slist_copy_deep (GSList *list,
0104 GCopyFunc func,
0105 gpointer user_data) G_GNUC_WARN_UNUSED_RESULT;
0106 GLIB_AVAILABLE_IN_ALL
0107 GSList* g_slist_nth (GSList *list,
0108 guint n);
0109 GLIB_AVAILABLE_IN_ALL
0110 GSList* g_slist_find (GSList *list,
0111 gconstpointer data);
0112 GLIB_AVAILABLE_IN_ALL
0113 GSList* g_slist_find_custom (GSList *list,
0114 gconstpointer data,
0115 GCompareFunc func);
0116 GLIB_AVAILABLE_IN_ALL
0117 gint g_slist_position (GSList *list,
0118 GSList *llink);
0119 GLIB_AVAILABLE_IN_ALL
0120 gint g_slist_index (GSList *list,
0121 gconstpointer data);
0122 GLIB_AVAILABLE_IN_ALL
0123 GSList* g_slist_last (GSList *list);
0124 GLIB_AVAILABLE_IN_ALL
0125 guint g_slist_length (GSList *list);
0126 GLIB_AVAILABLE_IN_ALL
0127 void g_slist_foreach (GSList *list,
0128 GFunc func,
0129 gpointer user_data);
0130 GLIB_AVAILABLE_IN_ALL
0131 GSList* g_slist_sort (GSList *list,
0132 GCompareFunc compare_func) G_GNUC_WARN_UNUSED_RESULT;
0133 GLIB_AVAILABLE_IN_ALL
0134 GSList* g_slist_sort_with_data (GSList *list,
0135 GCompareDataFunc compare_func,
0136 gpointer user_data) G_GNUC_WARN_UNUSED_RESULT;
0137 GLIB_AVAILABLE_IN_ALL
0138 gpointer g_slist_nth_data (GSList *list,
0139 guint n);
0140
0141 GLIB_AVAILABLE_IN_2_64
0142 void g_clear_slist (GSList **slist_ptr,
0143 GDestroyNotify destroy);
0144
0145 #define g_clear_slist(slist_ptr, destroy) \
0146 G_STMT_START { \
0147 GSList *_slist; \
0148 \
0149 _slist = *(slist_ptr); \
0150 if (_slist) \
0151 { \
0152 *slist_ptr = NULL; \
0153 \
0154 if ((destroy) != NULL) \
0155 g_slist_free_full (_slist, (destroy)); \
0156 else \
0157 g_slist_free (_slist); \
0158 } \
0159 } G_STMT_END \
0160 GLIB_AVAILABLE_MACRO_IN_2_64
0161
0162 #define g_slist_next(slist) ((slist) ? (((GSList *)(slist))->next) : NULL)
0163
0164 G_END_DECLS
0165
0166 #endif