Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-06 08:41:17

0001 /* GLIB - Library of useful routines for C programming
0002  * Copyright (C) 1995-1997  Peter Mattis, Spencer Kimball and Josh MacDonald
0003  *
0004  * SPDX-License-Identifier: LGPL-2.1-or-later
0005  *
0006  * This library is free software; you can redistribute it and/or
0007  * modify it under the terms of the GNU Lesser General Public
0008  * License as published by the Free Software Foundation; either
0009  * version 2.1 of the License, or (at your option) any later version.
0010  *
0011  * This library is distributed in the hope that it will be useful,
0012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0014  * Lesser General Public License for more details.
0015  *
0016  * You should have received a copy of the GNU Lesser General Public
0017  * License along with this library; if not, see <http://www.gnu.org/licenses/>.
0018  */
0019 
0020 /*
0021  * Modified by the GLib Team and others 1997-2000.  See the AUTHORS
0022  * file for a list of people on the GLib Team.  See the ChangeLog
0023  * files for a list of changes.  These files are distributed with
0024  * GLib at ftp://ftp.gtk.org/pub/gtk/.
0025  */
0026 
0027 #ifndef __G_LIST_H__
0028 #define __G_LIST_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 _GList GList;
0040 
0041 struct _GList
0042 {
0043   gpointer data;
0044   GList *next;
0045   GList *prev;
0046 };
0047 
0048 /* Doubly linked lists
0049  */
0050 GLIB_AVAILABLE_IN_ALL
0051 GList*   g_list_alloc                   (void) G_GNUC_WARN_UNUSED_RESULT;
0052 GLIB_AVAILABLE_IN_ALL
0053 void     g_list_free                    (GList            *list);
0054 GLIB_AVAILABLE_IN_ALL
0055 void     g_list_free_1                  (GList            *list);
0056 #define  g_list_free1                   g_list_free_1
0057 GLIB_AVAILABLE_IN_ALL
0058 void     g_list_free_full               (GList            *list,
0059                      GDestroyNotify    free_func);
0060 GLIB_AVAILABLE_IN_ALL
0061 GList*   g_list_append                  (GList            *list,
0062                      gpointer          data) G_GNUC_WARN_UNUSED_RESULT;
0063 GLIB_AVAILABLE_IN_ALL
0064 GList*   g_list_prepend                 (GList            *list,
0065                      gpointer          data) G_GNUC_WARN_UNUSED_RESULT;
0066 GLIB_AVAILABLE_IN_ALL
0067 GList*   g_list_insert                  (GList            *list,
0068                      gpointer          data,
0069                      gint              position) G_GNUC_WARN_UNUSED_RESULT;
0070 GLIB_AVAILABLE_IN_ALL
0071 GList*   g_list_insert_sorted           (GList            *list,
0072                      gpointer          data,
0073                      GCompareFunc      func) G_GNUC_WARN_UNUSED_RESULT;
0074 GLIB_AVAILABLE_IN_ALL
0075 GList*   g_list_insert_sorted_with_data (GList            *list,
0076                      gpointer          data,
0077                      GCompareDataFunc  func,
0078                      gpointer          user_data) G_GNUC_WARN_UNUSED_RESULT;
0079 GLIB_AVAILABLE_IN_ALL
0080 GList*   g_list_insert_before           (GList            *list,
0081                      GList            *sibling,
0082                      gpointer          data) G_GNUC_WARN_UNUSED_RESULT;
0083 GLIB_AVAILABLE_IN_2_62
0084 GList*   g_list_insert_before_link      (GList            *list,
0085                      GList            *sibling,
0086                      GList            *link_) G_GNUC_WARN_UNUSED_RESULT;
0087 GLIB_AVAILABLE_IN_ALL
0088 GList*   g_list_concat                  (GList            *list1,
0089                      GList            *list2) G_GNUC_WARN_UNUSED_RESULT;
0090 GLIB_AVAILABLE_IN_ALL
0091 GList*   g_list_remove                  (GList            *list,
0092                      gconstpointer     data) G_GNUC_WARN_UNUSED_RESULT;
0093 GLIB_AVAILABLE_IN_ALL
0094 GList*   g_list_remove_all              (GList            *list,
0095                      gconstpointer     data) G_GNUC_WARN_UNUSED_RESULT;
0096 GLIB_AVAILABLE_IN_ALL
0097 GList*   g_list_remove_link             (GList            *list,
0098                      GList            *llink) G_GNUC_WARN_UNUSED_RESULT;
0099 GLIB_AVAILABLE_IN_ALL
0100 GList*   g_list_delete_link             (GList            *list,
0101                      GList            *link_) G_GNUC_WARN_UNUSED_RESULT;
0102 GLIB_AVAILABLE_IN_ALL
0103 GList*   g_list_reverse                 (GList            *list) G_GNUC_WARN_UNUSED_RESULT;
0104 GLIB_AVAILABLE_IN_ALL
0105 GList*   g_list_copy                    (GList            *list) G_GNUC_WARN_UNUSED_RESULT;
0106 
0107 GLIB_AVAILABLE_IN_2_34
0108 GList*   g_list_copy_deep               (GList            *list,
0109                      GCopyFunc         func,
0110                      gpointer          user_data) G_GNUC_WARN_UNUSED_RESULT;
0111 
0112 GLIB_AVAILABLE_IN_ALL
0113 GList*   g_list_nth                     (GList            *list,
0114                      guint             n);
0115 GLIB_AVAILABLE_IN_ALL
0116 GList*   g_list_nth_prev                (GList            *list,
0117                      guint             n);
0118 GLIB_AVAILABLE_IN_ALL
0119 GList*   g_list_find                    (GList            *list,
0120                      gconstpointer     data);
0121 GLIB_AVAILABLE_IN_ALL
0122 GList*   g_list_find_custom             (GList            *list,
0123                      gconstpointer     data,
0124                      GCompareFunc      func);
0125 GLIB_AVAILABLE_IN_ALL
0126 gint     g_list_position                (GList            *list,
0127                      GList            *llink);
0128 GLIB_AVAILABLE_IN_ALL
0129 gint     g_list_index                   (GList            *list,
0130                      gconstpointer     data);
0131 GLIB_AVAILABLE_IN_ALL
0132 GList*   g_list_last                    (GList            *list);
0133 GLIB_AVAILABLE_IN_ALL
0134 GList*   g_list_first                   (GList            *list);
0135 GLIB_AVAILABLE_IN_ALL
0136 guint    g_list_length                  (GList            *list);
0137 GLIB_AVAILABLE_IN_ALL
0138 void     g_list_foreach                 (GList            *list,
0139                      GFunc             func,
0140                      gpointer          user_data);
0141 GLIB_AVAILABLE_IN_ALL
0142 GList*   g_list_sort                    (GList            *list,
0143                      GCompareFunc      compare_func) G_GNUC_WARN_UNUSED_RESULT;
0144 GLIB_AVAILABLE_IN_ALL
0145 GList*   g_list_sort_with_data          (GList            *list,
0146                      GCompareDataFunc  compare_func,
0147                      gpointer          user_data)  G_GNUC_WARN_UNUSED_RESULT;
0148 GLIB_AVAILABLE_IN_ALL
0149 gpointer g_list_nth_data                (GList            *list,
0150                      guint             n);
0151 
0152 GLIB_AVAILABLE_IN_2_64
0153 void     g_clear_list                   (GList           **list_ptr,
0154                                          GDestroyNotify    destroy);
0155 
0156 #define  g_clear_list(list_ptr, destroy)       \
0157   G_STMT_START {                               \
0158     GList *_list;                              \
0159                                                \
0160     _list = *(list_ptr);                       \
0161     if (_list)                                 \
0162       {                                        \
0163         *list_ptr = NULL;                      \
0164                                                \
0165         if ((destroy) != NULL)                 \
0166           g_list_free_full (_list, (destroy)); \
0167         else                                   \
0168           g_list_free (_list);                 \
0169       }                                        \
0170   } G_STMT_END                                 \
0171   GLIB_AVAILABLE_MACRO_IN_2_64
0172 
0173 
0174 #define g_list_previous(list)           ((list) ? (((GList *)(list))->prev) : NULL)
0175 #define g_list_next(list)           ((list) ? (((GList *)(list))->next) : NULL)
0176 
0177 G_END_DECLS
0178 
0179 #endif /* __G_LIST_H__ */