Software: Apache/2.0.54 (Fedora). PHP/5.0.4 uname -a: Linux mina-info.me 2.6.17-1.2142_FC4smp #1 SMP Tue Jul 11 22:57:02 EDT 2006 i686 uid=48(apache) gid=48(apache) groups=48(apache) Safe-mode: OFF (not secure) /usr/share/gtk-doc/html/glib/ drwxr-xr-x |
Viewing file: Select action/file-type:
Synopsis#include <glib.h> GSList; GSList* g_slist_alloc (void); GSList* g_slist_append (GSList *list, gpointer data); GSList* g_slist_prepend (GSList *list, gpointer data); GSList* g_slist_insert (GSList *list, gpointer data, gint position); GSList* g_slist_insert_before (GSList *slist, GSList *sibling, gpointer data); GSList* g_slist_insert_sorted (GSList *list, gpointer data, GCompareFunc func); GSList* g_slist_remove (GSList *list, gconstpointer data); GSList* g_slist_remove_link (GSList *list, GSList *link_); GSList* g_slist_delete_link (GSList *list, GSList *link_); GSList* g_slist_remove_all (GSList *list, gconstpointer data); void g_slist_free (GSList *list); void g_slist_free_1 (GSList *list); guint g_slist_length (GSList *list); GSList* g_slist_copy (GSList *list); GSList* g_slist_reverse (GSList *list); GSList* g_slist_sort (GSList *list, GCompareFunc compare_func); GSList* g_slist_sort_with_data (GSList *list, GCompareDataFunc compare_func, gpointer user_data); GSList* g_slist_concat (GSList *list1, GSList *list2); void g_slist_foreach (GSList *list, GFunc func, gpointer user_data); GSList* g_slist_last (GSList *list); #define g_slist_next (slist) GSList* g_slist_nth (GSList *list, guint n); gpointer g_slist_nth_data (GSList *list, guint n); GSList* g_slist_find (GSList *list, gconstpointer data); GSList* g_slist_find_custom (GSList *list, gconstpointer data, GCompareFunc func); gint g_slist_position (GSList *list, GSList *llink); gint g_slist_index (GSList *list, gconstpointer data); void g_slist_push_allocator (GAllocator *allocator); void g_slist_pop_allocator (void); DescriptionThe GSList structure and its associated functions provide a standard singly-linked list data structure. Each element in the list contains a piece of data, together with a pointer which links to the next element in the list. Using this pointer it is possible to move through the list in one direction only (unlike the Doubly-Linked Lists which allow movement in both directions). The data contained in each element can be either integer values, by using one of the Type Conversion Macros, or simply pointers to any type of data. List elements are allocated in blocks using a GAllocator, which is more efficient than allocating elements individually. Note that most of the GSList functions expect to be passed a pointer to the first element in the list. The functions which insert elements return the new start of the list, which may have changed.
There is no function to create a GSList.
To add elements, use
To remove elements, use
To find elements in the list use
To find the index of an element use
To call a function for each element in the list use
To free the entire list, use DetailsGSListtypedef struct { gpointer data; GSList *next; } GSList;
The GSList struct is used for each element in the singly-linked list.
The g_slist_alloc ()GSList* g_slist_alloc (void);
Allocates space for one GSList element.
It is called by the
g_slist_append ()GSList* g_slist_append (GSList *list, gpointer data); Adds a new element on to the end of the list. NoteThe return value is the new start of the list, which may have changed, so make sure you store the new value. /* Notice that these are initialized to the empty list. */ GSList *list = NULL, *number_list = NULL; /* This is a list of strings. */ list = g_slist_append (list, "first"); list = g_slist_append (list, "second"); /* This is a list of integers. */ number_list = g_slist_append (number_list, GINT_TO_POINTER (27)); number_list = g_slist_append (number_list, GINT_TO_POINTER (14)); g_slist_prepend ()GSList* g_slist_prepend (GSList *list, gpointer data); Adds a new element on to the start of the list. NoteThe return value is the new start of the list, which may have changed, so make sure you store the new value. /* Notice that it is initialized to the empty list. */ GSList *list = NULL; list = g_slist_prepend (list, "last"); list = g_slist_prepend (list, "first"); g_slist_insert ()GSList* g_slist_insert (GSList *list, gpointer data, gint position); Inserts a new element into the list at the given position. g_slist_insert_before ()GSList* g_slist_insert_before (GSList *slist, GSList *sibling, gpointer data);
Inserts a node before
g_slist_insert_sorted ()GSList* g_slist_insert_sorted (GSList *list, gpointer data, GCompareFunc func); Inserts a new element into the list, using the given comparison function to determine its position. g_slist_remove ()GSList* g_slist_remove (GSList *list, gconstpointer data); Removes an element from a GSList. If two elements contain the same data, only the first is removed. If none of the elements contain the data, the GSList is unchanged. g_slist_remove_link ()GSList* g_slist_remove_link (GSList *list, GSList *link_);
Removes an element from a GSList, without freeing the element.
The removed element's next link is set to g_slist_delete_link ()GSList* g_slist_delete_link (GSList *list, GSList *link_);
Deletes a node of
g_slist_remove_all ()GSList* g_slist_remove_all (GSList *list, gconstpointer data);
Removes all list nodes with data equal to
g_slist_free ()void g_slist_free (GSList *list); Frees all of the memory used by a GSList. The freed elements are added to the GAllocator free list.
g_slist_free_1 ()void g_slist_free_1 (GSList *list);
Frees one GSList element.
It is usually used after
g_slist_copy ()GSList* g_slist_copy (GSList *list); Copies a GSList. Note that this is a "shallow" copy. If the list elements consist of pointers to data, the pointers are copied but the actual data isn't.
g_slist_sort ()GSList* g_slist_sort (GSList *list, GCompareFunc compare_func); Sorts a GSList using the given comparison function. g_slist_sort_with_data ()GSList* g_slist_sort_with_data (GSList *list, GCompareDataFunc compare_func, gpointer user_data);
Like
g_slist_concat ()GSList* g_slist_concat (GSList *list1, GSList *list2); Adds the second GSList onto the end of the first GSList. Note that the elements of the second GSList are not copied. They are used directly. g_slist_foreach ()void g_slist_foreach (GSList *list, GFunc func, gpointer user_data); Calls a function for each element of a GSList.
g_slist_next()#define g_slist_next(slist) A convenience macro to gets the next element in a GSList.
g_slist_nth ()GSList* g_slist_nth (GSList *list, guint n); Gets the element at the given position in a GSList. g_slist_nth_data ()gpointer g_slist_nth_data (GSList *list, guint n); Gets the data of the element at the given position. g_slist_find ()GSList* g_slist_find (GSList *list, gconstpointer data); Finds the element in a GSList which contains the given data. g_slist_find_custom ()GSList* g_slist_find_custom (GSList *list, gconstpointer data, GCompareFunc func); Finds an element in a GSList, using a supplied function to find the desired element. It iterates over the list, calling the given function which should return 0 when the desired element is found. The function takes two gconstpointer arguments, the GSList element's data and the given user data. g_slist_position ()gint g_slist_position (GSList *list, GSList *llink); Gets the position of the given element in the GSList (starting from 0). g_slist_index ()gint g_slist_index (GSList *list, gconstpointer data); Gets the position of the element containing the given data (starting from 0).
g_slist_push_allocator ()void g_slist_push_allocator (GAllocator *allocator);
Sets the allocator to use to allocate GSList elements.
Use
Note that this function is not available if GLib has been compiled
with
g_slist_pop_allocator ()void g_slist_pop_allocator (void); Restores the previous GAllocator, used when allocating GSList elements.
Note that this function is not available if GLib has been compiled
with
|
:: Command execute :: | |
--[ c99shell v. 1.0 pre-release build #16 powered by Captain Crunch Security Team | http://ccteam.ru | Generation time: 0.0043 ]-- |