List handling functions List handling functions Introduction When developing an application of any mangnitude there comes a time when you will need to deal with lists of data within your application. To this end GLIB provides some convient functions to handle both signly linked lists, and doubly linked lists. Facilities also exist for custom list handling if the basic lists don't suite your purpose. This chapter will cover the all the functions provided in GLIB for list management. List Allocators Describe the list allocation functions... g_list_allocator_new GListAllocator *g_list_allocator_new GListAllocator *allocator Description Describe this function Usage FIXME! Parameters GListAllocator *allocator A list allocator pointer g_list_allocator_free void g_list_allocator_free GListAllocator *allocator Description Describe this thing. Usage FIXME! Parameters GListAllocator *allocator The pointer to list allocator to free. g_slist_set_allocator GListAllocator *g_slist_set_allocator GListAllocator *allocator Description This function will set the allocator for a singly linked list Usage FIXME Parameters GListAllocator *allocator The pointer to the list allocator to use for the signly linked lists allocations. g_list_set_allocator GListAllocator *g_list_set_allocator GListAllocator *allocator Description This function will set the allocator for a doubly linked list Usage FIXME Parameters GListAllocator *allocator The pointer to the list allocator to use for the doubly linked list allocations. Signly linked lists Signly linked lists! g_slist_alloc GSList *g_slist_alloc voidnone Description Usage FIXME Parameters void (null) This function takes no arguments g_slist_free GSList *g_slist_free GSList *list Description Usage FIXME Parameters GSList *list A pointer to a GSList structure. g_slist_free_1 GSList *g_slist_free_1 GSList *list Description Usage FIXME Parameters GSList *list A pointer to a GSList structure. g_slist_append GSList *g_slist_append GSList *list gpointer data Description Append the data to the list given in the list argument. This function will store the pointer to the data and return a new list pointer with the new element attached to the end. Usage FIXME Parameters GSList *list The pointer to the list to append the dataitem to. This can be NULL in the case of a new list. gpointer data A pointer to the data to store in this list element g_slist_preppend GSList *g_slist_preppend GSList *list gpointer data Description Usage FIXME Parameters GSList *list A pointer to a GSList structure. gpointer data A pointer to the data for this list element g_slist_insert GSList *g_slist_insert GSList *list gpointer data gint position Description Usage FIXME Parameters GSList *list A pointer to a GSList structure. g_slist_insert_sorted GSList *g_slist_insert_sorted GSList *list gpointer data GCompareFunc func Description Usage FIXME g_slist_concat GSList *g_slist_concat GSList *list1 GSList *list2 Description Usage FIXME g_slist_remove GSList *g_slist_remove GSList *list gpointer data Description Usage FIXME g_slist_remove_link GSList *g_slist_remove_link GSList *list GSList *llink Description Usage FIXME g_slist_reverse GSList *g_slist_reverse GSList *list Description Usage FIXME g_slist_nth GSList *g_slist_nth GSList *list guint n Description Usage FIXME g_slist_find GSList *g_slist_find GSList *list gpointer data Description Usage FIXME g_slist_find_custom GSList *g_slist_find_custom GSList *list gpointer data GCompareFunc func Description Usage FIXME g_slist_position gint g_slist_position GSList *list GSList *llink Description Usage FIXME g_slist_index gint g_slist_index GSList *list gpointer data Description Usage FIXME g_slist_last GSList *g_slist_last GSList *list Description Usage FIXME g_slist_length guint g_slist_length GSList *list Description Usage FIXME g_slist_foreach void g_slist_foreach GSList *list GFunc func gpointer user_data Description Usage FIXME g_slist_nth_data gpointer g_slist_nth_data GSList *list guint n Description Usage FIXME g_slist_next GSList *g_slist_next GSList *list Description Usage FIXME Doubly linked lists Doubly linked lists! g_list_alloc GList *g_list_alloc voidnone Description Usage FIXME g_list_free GList *g_list_free GList *list Description This function will destroy and free the resources used by the GList structure. It will not free the resources consumed by the data pointers in the list that is up to the application to free. Usage GList *list; /* add elements and otherwise manipulate the list */ /* once finished with the list free all elements of the list */ /* Then free the list structure itself */ g_list_free (list); Parameters GList *list A pointer to the GList structure to free g_list_free_1 GList *g_list_free_1 GList *list Description Usage FIXME g_list_append GList *g_list_append GList *list gpointer data Description Usage FIXME g_list_preppend GList *g_list_preppend GList *list gpointer data Description Usage FIXME g_list_insert GList *g_list_insert GList *list gpointer data gint position Description Usage FIXME g_list_insert_sorted GList *g_list_insert_sorted GList *list gpointer data GCompareFunc func Description Usage FIXME g_list_concat GList *g_list_concat GList *list1 GList *list2 Description Usage FIXME g_list_remove GList *g_list_remove GList *list gpointer data Description Usage FIXME g_list_remove_link GList *g_list_remove_link GList *list GList *llink Description Usage FIXME g_list_reverse GList *g_list_reverse GList *list Description Usage FIXME g_list_nth GList *g_list_nth GList *list guint n Description Usage FIXME g_list_find GList *g_list_find GList *list gpointer data Description Usage FIXME g_list_find_custom GList *g_list_find_custom GList *list gpointer data GCompareFunc func Description Usage FIXME g_list_position gint g_list_position GList *list GList *llink Description Usage FIXME g_list_index gint g_list_index GList *list gpointer data Description Usage FIXME g_list_last GList *g_list_last GList *list Description Usage FIXME g_list_length guint g_list_length GList *list Description Usage FIXME g_list_foreach void g_list_foreach GList *list GFunc func gpointer user_data Description Usage FIXME g_list_nth_data gpointer g_list_nth_data GList *list guint n Description Usage FIXME g_list_previous GList *g_list_previous GList *list Description Usage FIXME g_list_next GList *g_list_next GList *list Description Usage FIXME