43 while (*list) list = &(*list)->
next;
75 while ((
string !=
nullptr) && (list !=
nullptr)) {
76 if (
Q_streq(static_cast<char const*>(list->
data),
string))
93 while ((data !=
nullptr) && (list !=
nullptr)) {
94 if (list->
data == data)
112 for (; *listDest; listDest = &(*listDest)->
next) {
113 if (
Q_StringSort(data, static_cast<char const*>((*listDest)->data)) < 0)
159 newEntry->
ptr =
true;
177 for (; *list; list = &(*list)->
next) {
178 if (*list == entry) {
251 for (
int i = 0;
i < insize;
i++) {
262 while (psize > 0 || (qsize > 0 && q)) {
269 }
else if (qsize == 0 || !q) {
274 }
else if (sorter(p, q, userData) <= 0) {
299 tail->
next =
nullptr;
337 return list ==
nullptr;
387 const int element = rand() % elements;
Memory handling with sentinel checking and pools with tags for grouped free'ing.
void LIST_PrependString(linkedList_t **listDest, const char *data)
Adds a string as first entry to a linked list.
linkedList_t * LIST_Add(linkedList_t **listDest, void const *data, size_t length)
Adds an entry to a new or to an already existing linked list.
static linkedList_t * _LIST_Sort(linkedList_t *list, linkedListSort_t sorter, const void *userData)
This is the actual sort function. Notice that it returns the new head of the list. (It has to, because the head will not generally be the same element after the sort.)
void LIST_AddStringSorted(linkedList_t **listDest, const char *data)
void * LIST_GetByIdx(linkedList_t *list, int index)
Get an entry of a linked list by its index in the list.
static void LIST_AppendEntry(linkedList_t **list, linkedList_t *const entry)
int(* linkedListSort_t)(linkedList_t *entry1, linkedList_t *entry2, const void *userData)
static linkedList_t * LIST_AllocateString(char const *data, linkedList_t *const next=0)
void LIST_Delete(linkedList_t **list)
int LIST_Count(const linkedList_t *list)
static linkedList_t * LIST_AllocateEntry(void *const data, linkedList_t *const next=0)
bool LIST_Remove(linkedList_t **list, const void *data)
void LIST_AddString(linkedList_t **listDest, const char *data)
Adds an string to a new or to an already existing linked list. The string is copied here...
QGL_EXTERN GLuint GLsizei GLsizei * length
memPool_t * com_genericPool
linkedList_t * LIST_CopyStructure(linkedList_t *src)
Copies the list structure data - but not the content from the original list. We are only using pointe...
const linkedList_t * LIST_ContainsString(const linkedList_t *list, const char *string)
Searches for the first occurrence of a given string.
QGL_EXTERN GLenum GLuint * dest
bool LIST_RemoveEntry(linkedList_t **list, linkedList_t *entry)
Removes one entry from the linked list.
#define Mem_PoolAllocTypeN(type, n, pool)
linkedList_t * LIST_GetPointer(linkedList_t *list, const void *data)
Searches for the first occurrence of a given pointer.
#define LIST_Foreach(list, type, var)
Iterates over a linked list, it's safe to delete the returned entry from the list while looping over ...
definitions common between client and server, but not game lib
int Q_StringSort(const void *string1, const void *string2)
Compare two strings.
GLsizei const GLvoid * data
bool LIST_IsEmpty(const linkedList_t *list)
Checks whether the given list is empty.
#define Mem_PoolAllocType(type, pool)
void LIST_Sort(linkedList_t **list, linkedListSort_t sorter, const void *userData)
void * LIST_GetRandom(linkedList_t *list)
void LIST_AddPointer(linkedList_t **listDest, void *data)
Adds just a pointer to a new or to an already existing linked list.