|
gwenhywfar 5.14.1
|
#include "list_p.h"#include <gwenhywfar/misc.h>#include <gwenhywfar/debug.h>
Go to the source code of this file.
Macros | |
| #define | DISABLE_DEBUGLOG |
| #define DISABLE_DEBUGLOG |
Definition at line 30 of file src/base/list.c.
| void GWEN__ListPtr_Attach | ( | GWEN__LISTPTR * | lp | ) |
Definition at line 97 of file src/base/list.c.
Referenced by GWEN_List_dup().

| void GWEN__ListPtr_Clear | ( | GWEN__LISTPTR * | lp | ) |
Definition at line 106 of file src/base/list.c.
References GWEN_ListEntry_free().
Referenced by GWEN__ListPtr_free(), and GWEN_List_Clear().


| GWEN__LISTPTR * GWEN__ListPtr_dup | ( | GWEN__LISTPTR * | lp | ) |
Definition at line 126 of file src/base/list.c.
References GWEN__ListPtr_new(), GWEN_ListEntry_new(), and GWEN_RefPtr_dup().
Referenced by GWEN_List_Clear(), GWEN_List_Erase(), GWEN_List_PopBack(), GWEN_List_PopFront(), GWEN_List_PushBackRefPtr(), GWEN_List_PushFrontRefPtr(), and GWEN_List_Unshare().


| void GWEN__ListPtr_free | ( | GWEN__LISTPTR * | lp | ) |
Definition at line 84 of file src/base/list.c.
References GWEN__ListPtr_Clear(), and GWEN_FREE_OBJECT.
Referenced by GWEN_List_Clear(), GWEN_List_Erase(), GWEN_List_free(), GWEN_List_PopBack(), GWEN_List_PopFront(), GWEN_List_PushBackRefPtr(), GWEN_List_PushFrontRefPtr(), and GWEN_List_Unshare().


| GWEN__LISTPTR * GWEN__ListPtr_new | ( | void | ) |
Definition at line 73 of file src/base/list.c.
References GWEN_NEW_OBJECT.
Referenced by GWEN__ListPtr_dup(), and GWEN_List_new().

| void GWEN_ConstList_Clear | ( | GWEN_CONSTLIST * | l | ) |
Removes all list elements from the list. The elements are not freed.
Definition at line 898 of file src/base/list.c.
References GWEN_List_Clear().
Referenced by check_constlist().


| const void * GWEN_ConstList_Contains | ( | const GWEN_CONSTLIST * | l, |
| const void * | element ) |
Searches whether the list contains the given element. If it does, the pointer to the element is returned. Otherwise, NULL is returned.
Definition at line 950 of file src/base/list.c.
References GWEN_ConstList_FindIter(), and GWEN_ConstListIterator_free().

| void GWEN_ConstList_Erase | ( | GWEN_CONSTLIST * | l, |
| GWEN_CONSTLIST_ITERATOR * | it ) |
Removes the element currently pointed to by the given iterator from the list. (The element is not freed.) The given iterator is move toward the next element in any case (if there is no next element then the iterator will point to 0).
Definition at line 891 of file src/base/list.c.
References GWEN_List_Erase().
Referenced by GWEN_ConstList_Remove().


| GWEN_CONSTLIST_ITERATOR * GWEN_ConstList_FindIter | ( | const GWEN_CONSTLIST * | l, |
| const void * | element ) |
Finds the LIST_ITERATOR position of the given element. The returned LIST_ITERATOR will be owned by the caller and must be freed when no longer in use. If the list does not contain the element, NULL will be returned.
Definition at line 930 of file src/base/list.c.
References GWEN_ConstList_First(), GWEN_ConstListIterator_Data(), GWEN_ConstListIterator_free(), and GWEN_ConstListIterator_Next().
Referenced by GWEN_ConstList_Contains(), and GWEN_ConstList_Remove().


| GWEN_CONSTLIST_ITERATOR * GWEN_ConstList_First | ( | const GWEN_CONSTLIST * | l | ) |
Return an iterator pointing to the first element in the list
Definition at line 972 of file src/base/list.c.
References GWEN_List_First().
Referenced by check_constlist(), and GWEN_ConstList_FindIter().


| const void * GWEN_ConstList_ForEach | ( | GWEN_CONSTLIST * | list, |
| GWEN_CONSTLIST_FOREACH_CB | func, | ||
| void * | user_data ) |
Traverses the list, calling the callback function 'func' on each list element. Traversal will stop when 'func' returns a non-NULL value, and the routine will return with that value. Otherwise the routine will return NULL.
| list | The list to traverse. |
| func | The function to be called with each list element. |
| user_data | A pointer passed on to the function 'func'. |
Definition at line 904 of file src/base/list.c.
References GWEN_List_First(), GWEN_ListIterator_Data(), GWEN_ListIterator_free(), and GWEN_ListIterator_Next().

| void GWEN_ConstList_free | ( | GWEN_CONSTLIST * | l | ) |
Destructor. Frees all of the memory used by this list. The list elements are not freed
Definition at line 830 of file src/base/list.c.
References GWEN_List_free().
Referenced by check_constlist().


| const void * GWEN_ConstList_GetBack | ( | const GWEN_CONSTLIST * | l | ) |
Returns the last element of the list. (The element is not removed from the list.)
Definition at line 858 of file src/base/list.c.
References GWEN_List_GetBack().
Referenced by check_constlist().


| const void * GWEN_ConstList_GetFront | ( | const GWEN_CONSTLIST * | l | ) |
Returns the first element of the list. (The element is not removed from the list.)
Definition at line 851 of file src/base/list.c.
References GWEN_List_GetFront().
Referenced by check_constlist().


| unsigned int GWEN_ConstList_GetSize | ( | const GWEN_CONSTLIST * | l | ) |
Returns the size of this list, i.e. the number of elements in this list.
This number is counted in the list metadata, so this is a cheap operation.
Definition at line 865 of file src/base/list.c.
References GWEN_List_GetSize().
Referenced by check_constlist(), and GWEN_ConstList_IsEmpty().


| int GWEN_ConstList_IsEmpty | ( | const GWEN_LIST * | l | ) |
Returns nonzero (TRUE) if this list is empty, and zero (FALSE) if this list is not empty.
Definition at line 870 of file src/base/list.c.
References GWEN_ConstList_GetSize().

| GWEN_CONSTLIST_ITERATOR * GWEN_ConstList_Last | ( | const GWEN_CONSTLIST * | l | ) |
Returns an iterator pointing to the last element in the list.
Definition at line 979 of file src/base/list.c.
References GWEN_List_Last().

| GWEN_CONSTLIST * GWEN_ConstList_new | ( | void | ) |
Constructor. Returns a new empty list.
Definition at line 823 of file src/base/list.c.
References GWEN_List_new().
Referenced by check_constlist().


| void GWEN_ConstList_PopBack | ( | GWEN_CONSTLIST * | l | ) |
Removes the list's last element from the list. (The element is not freed.)
Definition at line 877 of file src/base/list.c.
References GWEN_List_PopBack().
Referenced by check_constlist().


| void GWEN_ConstList_PopFront | ( | GWEN_CONSTLIST * | l | ) |
Removes the list's first element from the list. (The element is not freed.)
Definition at line 884 of file src/base/list.c.
References GWEN_List_PopFront().

| void GWEN_ConstList_PushBack | ( | GWEN_CONSTLIST * | l, |
| const void * | p ) |
Appends an element to a list, making it the new last element.
Definition at line 837 of file src/base/list.c.
References GWEN_List_PushBack().
Referenced by check_constlist().


| void GWEN_ConstList_PushFront | ( | GWEN_CONSTLIST * | l, |
| const void * | p ) |
Inserts an element at the start of the list, making it the new first element.
Definition at line 844 of file src/base/list.c.
References GWEN_List_PushFront().
Referenced by check_constlist().


| void GWEN_ConstList_Remove | ( | GWEN_CONSTLIST * | l, |
| const void * | element ) |
Searches for the first occurrence of the "element" pointer and erases that element from the list. (The element itself is not freed.) I.e. this function calls GWEN_List_Erase on the first occurrence found of "element".
Definition at line 962 of file src/base/list.c.
References GWEN_ConstList_Erase(), and GWEN_ConstList_FindIter().

| const void * GWEN_ConstListIterator_Data | ( | GWEN_CONSTLIST_ITERATOR * | li | ) |
Returns the pointer to the element stored at the list position the iterator currently points to.
Definition at line 1014 of file src/base/list.c.
References GWEN_ListIterator_Data().
Referenced by check_constlist(), and GWEN_ConstList_FindIter().


| void GWEN_ConstListIterator_free | ( | GWEN_CONSTLIST_ITERATOR * | li | ) |
Frees a list iterator.
Definition at line 993 of file src/base/list.c.
References GWEN_ListIterator_free().
Referenced by check_constlist(), GWEN_ConstList_Contains(), and GWEN_ConstList_FindIter().


| GWEN_CONSTLIST_ITERATOR * GWEN_ConstListIterator_new | ( | const GWEN_CONSTLIST * | l | ) |
Creates a list iterator for the given list.
Definition at line 986 of file src/base/list.c.
References GWEN_ListIterator_new().

| const void * GWEN_ConstListIterator_Next | ( | GWEN_CONSTLIST_ITERATOR * | li | ) |
Moves the list iterator to the successor of the currenty selected element and returns that successor element.
Definition at line 1007 of file src/base/list.c.
References GWEN_ListIterator_Next().
Referenced by check_constlist(), and GWEN_ConstList_FindIter().


| const void * GWEN_ConstListIterator_Previous | ( | GWEN_CONSTLIST_ITERATOR * | li | ) |
Moves the list iterator to the predecessor of the currenty selected element and returns that predecessor element.
Definition at line 1000 of file src/base/list.c.
References GWEN_ListIterator_Previous().
Referenced by check_constlist().


| void GWEN_List_Clear | ( | GWEN_LIST * | l | ) |
Removes all list elements from the list. The elements are not freed.
Definition at line 424 of file src/base/list.c.
References GWEN__ListPtr_Clear(), GWEN__ListPtr_dup(), and GWEN__ListPtr_free().
Referenced by check_list(), and GWEN_ConstList_Clear().


| const void * GWEN_List_Contains | ( | GWEN_LIST * | l, |
| const void * | element ) |
Searches whether the list contains the given element. If it does, the pointer to the element is returned. Otherwise, NULL is returned.
Definition at line 586 of file src/base/list.c.
References GWEN_List_FindIter(), and GWEN_ListIterator_free().

| void GWEN_List_Dump | ( | const GWEN_LIST * | l, |
| FILE * | f, | ||
| unsigned int | indent ) |
Dumps the contents of the list to an open file (e.g. stderr).
Definition at line 648 of file src/base/list.c.
References GWEN_RefPtr_GetData().

Duplicates a list by returning a reference and using reference-counting.
Definition at line 187 of file src/base/list.c.
References GWEN__ListPtr_Attach(), GWEN_INHERIT_INIT, and GWEN_NEW_OBJECT.
Referenced by GWEN_StringList2_dup().


| void GWEN_List_Erase | ( | GWEN_LIST * | l, |
| GWEN_LIST_ITERATOR * | it ) |
Removes the element currently pointed to by the given iterator from the list. (The element is not freed.) The given iterator is move toward the next element in any case (if there is no next element then the iterator will point to 0).
Definition at line 482 of file src/base/list.c.
References GWEN__ListPtr_dup(), GWEN__ListPtr_free(), and GWEN_ListEntry_free().
Referenced by check_list(), GWEN_ConstList_Erase(), GWEN_List_Remove(), and GWEN_StringList2_RemoveString().


| GWEN_LIST_ITERATOR * GWEN_List_FindIter | ( | GWEN_LIST * | l, |
| const void * | element ) |
Finds the LIST_ITERATOR position of the given element. The returned LIST_ITERATOR will be owned by the caller and must be freed when no longer in use. If the list does not contain the element, NULL will be returned.
Definition at line 564 of file src/base/list.c.
References GWEN_List_First(), GWEN_ListIterator_Data(), GWEN_ListIterator_free(), and GWEN_ListIterator_Next().
Referenced by GWEN_List_Contains(), and GWEN_List_Remove().


| GWEN_LIST_ITERATOR * GWEN_List_First | ( | const GWEN_LIST * | l | ) |
Return an iterator pointing to the first element in the list
Definition at line 613 of file src/base/list.c.
References GWEN_ListIterator_new().
Referenced by check_list(), GWEN_ConstList_First(), GWEN_ConstList_ForEach(), GWEN_List_FindIter(), GWEN_List_ForEach(), and GWEN_StringList2_First().


| void * GWEN_List_ForEach | ( | GWEN_LIST * | list, |
| GWEN_LIST_FOREACH_CB | func, | ||
| void * | user_data ) |
Traverses the list, calling the callback function 'func' on each list element. Traversal will stop when 'func' returns a non-NULL value, and the routine will return with that value. Otherwise the routine will return NULL.
| list | The list to traverse. |
| func | The function to be called with each list element. |
| user_data | A pointer passed on to the function 'func'. |
Definition at line 443 of file src/base/list.c.
References GWEN_List_First(), GWEN_ListIterator_Data(), GWEN_ListIterator_free(), and GWEN_ListIterator_Next().

| void GWEN_List_free | ( | GWEN_LIST * | l | ) |
Destructor. Frees all of the memory used by this list. The list elements are not freed.
Definition at line 175 of file src/base/list.c.
References GWEN__ListPtr_free(), GWEN_FREE_OBJECT, GWEN_INHERIT_FINI, and GWEN_RefPtrInfo_free().
Referenced by check_list(), GWEN_ConstList_free(), and GWEN_StringList2_free().


| void * GWEN_List_GetBack | ( | const GWEN_LIST * | l | ) |
Returns the last element of the list. (The element is not removed from the list.)
Definition at line 315 of file src/base/list.c.
References GWEN_RefPtr_GetData().
Referenced by check_list(), and GWEN_ConstList_GetBack().


| GWEN_REFPTR * GWEN_List_GetBackRefPtr | ( | const GWEN_LIST * | l | ) |
Returns the last element of the list. (The element is not removed from the list.)
Definition at line 326 of file src/base/list.c.
| void * GWEN_List_GetFront | ( | const GWEN_LIST * | l | ) |
Returns the first element of the list. (The element is not removed from the list.)
Definition at line 293 of file src/base/list.c.
References GWEN_RefPtr_GetData().
Referenced by check_list(), and GWEN_ConstList_GetFront().


| GWEN_REFPTR * GWEN_List_GetFrontRefPtr | ( | const GWEN_LIST * | l | ) |
Returns the first element of the list. (The element is not removed from the list.)
Definition at line 304 of file src/base/list.c.
| GWEN_REFPTR_INFO * GWEN_List_GetRefPtrInfo | ( | const GWEN_LIST * | l | ) |
Definition at line 202 of file src/base/list.c.
Referenced by GWEN_StringList2_AppendString(), and GWEN_StringList2_InsertString().

| unsigned int GWEN_List_GetSize | ( | const GWEN_LIST * | l | ) |
Returns the size of this list, i.e. the number of elements in this list.
This number is counted in the list metadata, so this is a cheap operation.
Definition at line 337 of file src/base/list.c.
Referenced by check_list(), GWEN_ConstList_GetSize(), GWEN_List_IsEmpty(), and GWEN_StringList2_GetCount().

| int GWEN_List_IsEmpty | ( | const GWEN_LIST * | l | ) |
Returns nonzero (TRUE) if this list is empty, and zero (FALSE) if this list is not empty.
Definition at line 344 of file src/base/list.c.
References GWEN_List_GetSize().

| GWEN_LIST_ITERATOR * GWEN_List_Last | ( | const GWEN_LIST * | l | ) |
Returns an iterator pointing to the last element in the list.
Definition at line 631 of file src/base/list.c.
References GWEN_ListIterator_new().
Referenced by GWEN_ConstList_Last(), and GWEN_StringList2_Last().


| GWEN_LIST * GWEN_List_new | ( | void | ) |
allow inheriting of lists Constructor. Returns a new empty list.
Definition at line 163 of file src/base/list.c.
References GWEN__ListPtr_new(), GWEN_INHERIT_INIT, and GWEN_NEW_OBJECT.
Referenced by check_list(), GWEN_ConstList_new(), and GWEN_StringList2_new().


| void GWEN_List_PopBack | ( | GWEN_LIST * | l | ) |
Removes the list's last element from the list. (The element is not freed.)
Definition at line 350 of file src/base/list.c.
References GWEN__ListPtr_dup(), GWEN__ListPtr_free(), and GWEN_ListEntry_free().
Referenced by check_list(), and GWEN_ConstList_PopBack().


| void GWEN_List_PopFront | ( | GWEN_LIST * | l | ) |
Removes the list's first element from the list. (The element is not freed.)
Definition at line 387 of file src/base/list.c.
References GWEN__ListPtr_dup(), GWEN__ListPtr_free(), and GWEN_ListEntry_free().
Referenced by GWEN_ConstList_PopFront().


| void GWEN_List_PushBack | ( | GWEN_LIST * | l, |
| void * | p ) |
Appends an element to a list, making it the new last element.
Definition at line 250 of file src/base/list.c.
References GWEN_List_PushBackRefPtr(), and GWEN_RefPtr_new().
Referenced by check_list(), and GWEN_ConstList_PushBack().


| void GWEN_List_PushBackRefPtr | ( | GWEN_LIST * | l, |
| GWEN_REFPTR * | rp ) |
Appends an element to a list, making it the new last element.
Definition at line 221 of file src/base/list.c.
References GWEN__ListPtr_dup(), GWEN__ListPtr_free(), and GWEN_ListEntry_new().
Referenced by GWEN_List_PushBack(), and GWEN_StringList2_AppendString().


| void GWEN_List_PushFront | ( | GWEN_LIST * | l, |
| void * | p ) |
Inserts an element at the start of the list, making it the new first element.
Definition at line 286 of file src/base/list.c.
References GWEN_List_PushFrontRefPtr(), and GWEN_RefPtr_new().
Referenced by check_list(), and GWEN_ConstList_PushFront().


| void GWEN_List_PushFrontRefPtr | ( | GWEN_LIST * | l, |
| GWEN_REFPTR * | rp ) |
Inserts an element at the start of the list, making it the new first element.
Definition at line 257 of file src/base/list.c.
References GWEN__ListPtr_dup(), GWEN__ListPtr_free(), and GWEN_ListEntry_new().
Referenced by GWEN_List_PushFront(), and GWEN_StringList2_InsertString().


| void GWEN_List_Remove | ( | GWEN_LIST * | l, |
| const void * | element ) |
Searches for the first occurrence of the "element" pointer and erases that element from the list. (The element itself is not freed.) I.e. this function calls GWEN_List_Erase on the first occurrence found of "element".
Definition at line 600 of file src/base/list.c.
References GWEN_List_Erase(), GWEN_List_FindIter(), and GWEN_ListIterator_free().
Referenced by check_list().


| void GWEN_List_SetRefPtrInfo | ( | GWEN_LIST * | l, |
| GWEN_REFPTR_INFO * | rpi ) |
Definition at line 210 of file src/base/list.c.
References GWEN_RefPtrInfo_Attach(), and GWEN_RefPtrInfo_free().
Referenced by GWEN_StringList2_new().


| void GWEN_List_Unshare | ( | GWEN_LIST * | l | ) |
Definition at line 468 of file src/base/list.c.
References GWEN__ListPtr_dup(), and GWEN__ListPtr_free().

| void GWEN_ListEntry_free | ( | GWEN_LIST_ENTRY * | le | ) |
Definition at line 53 of file src/base/list.c.
References DBG_VERBOUS, GWEN_FREE_OBJECT, GWEN_LOGDOMAIN, and GWEN_RefPtr_free().
Referenced by GWEN__ListPtr_Clear(), GWEN_List_Erase(), GWEN_List_PopBack(), GWEN_List_PopFront(), GWEN_ListIterator_free(), GWEN_ListIterator_NextRefPtr(), and GWEN_ListIterator_PreviousRefPtr().


| GWEN_LIST_ENTRY * GWEN_ListEntry_new | ( | void | ) |
Definition at line 42 of file src/base/list.c.
References GWEN_ListEntry_new(), and GWEN_NEW_OBJECT.
Referenced by GWEN__ListPtr_dup(), GWEN_List_PushBackRefPtr(), GWEN_List_PushFrontRefPtr(), and GWEN_ListEntry_new().


| void * GWEN_ListIterator_Data | ( | GWEN_LIST_ITERATOR * | li | ) |
Returns the pointer to the element stored at the list position the iterator currently points to.
Definition at line 768 of file src/base/list.c.
References GWEN_RefPtr_GetData().
Referenced by check_list(), GWEN_ConstList_ForEach(), GWEN_ConstListIterator_Data(), GWEN_List_FindIter(), GWEN_List_ForEach(), and GWEN_StringList2Iterator_Data().


| GWEN_REFPTR * GWEN_ListIterator_DataRefPtr | ( | GWEN_LIST_ITERATOR * | li | ) |
Returns the pointer to the element stored at the list position the iterator currently points to.
Definition at line 779 of file src/base/list.c.
Referenced by GWEN_StringList2__GetString(), GWEN_StringList2_GetStringAt(), and GWEN_StringList2Iterator_DataRefPtr().

| void GWEN_ListIterator_free | ( | GWEN_LIST_ITERATOR * | li | ) |
Frees a list iterator.
Definition at line 689 of file src/base/list.c.
References GWEN_FREE_OBJECT, and GWEN_ListEntry_free().
Referenced by check_list(), GWEN_ConstList_ForEach(), GWEN_ConstListIterator_free(), GWEN_List_Contains(), GWEN_List_FindIter(), GWEN_List_ForEach(), GWEN_List_Remove(), and GWEN_StringList2Iterator_free().


| unsigned int GWEN_ListIterator_GetLinkCount | ( | const GWEN_LIST_ITERATOR * | li | ) |
Definition at line 800 of file src/base/list.c.
Referenced by GWEN_StringList2_RemoveString(), and GWEN_StringList2Iterator_GetLinkCount().

| void GWEN_ListIterator_IncLinkCount | ( | GWEN_LIST_ITERATOR * | li | ) |
Definition at line 790 of file src/base/list.c.
Referenced by GWEN_StringList2_AppendString(), and GWEN_StringList2_InsertString().

| GWEN_LIST_ITERATOR * GWEN_ListIterator_new | ( | const GWEN_LIST * | l | ) |
Creates a list iterator for the given list.
Definition at line 678 of file src/base/list.c.
References GWEN_NEW_OBJECT.
Referenced by GWEN_ConstListIterator_new(), GWEN_List_First(), and GWEN_List_Last().

| void * GWEN_ListIterator_Next | ( | GWEN_LIST_ITERATOR * | li | ) |
Moves the list iterator to the successor of the currenty selected element and returns that successor element.
Definition at line 734 of file src/base/list.c.
References GWEN_ListIterator_NextRefPtr(), and GWEN_RefPtr_GetData().
Referenced by check_list(), GWEN_ConstList_ForEach(), GWEN_ConstListIterator_Next(), GWEN_List_FindIter(), GWEN_List_ForEach(), and GWEN_StringList2Iterator_Next().


| GWEN_REFPTR * GWEN_ListIterator_NextRefPtr | ( | GWEN_LIST_ITERATOR * | li | ) |
Moves the list iterator to the successor of the currenty selected element and returns that successor element.
Definition at line 747 of file src/base/list.c.
References GWEN_ListEntry_free().
Referenced by GWEN_ListIterator_Next(), GWEN_StringList2__GetString(), and GWEN_StringList2_GetStringAt().


| void * GWEN_ListIterator_Previous | ( | GWEN_LIST_ITERATOR * | li | ) |
Moves the list iterator to the predecessor of the currenty selected element and returns that predecessor element.
Definition at line 700 of file src/base/list.c.
References GWEN_ListIterator_PreviousRefPtr(), and GWEN_RefPtr_GetData().
Referenced by check_list(), GWEN_ConstListIterator_Previous(), and GWEN_StringList2Iterator_Previous().


| GWEN_REFPTR * GWEN_ListIterator_PreviousRefPtr | ( | GWEN_LIST_ITERATOR * | li | ) |
Moves the list iterator to the predecessor of the currenty selected element and returns that predecessor element.
Definition at line 713 of file src/base/list.c.
References GWEN_ListEntry_free().
Referenced by GWEN_ListIterator_Previous().

