#include "list.h"
#include "mem.h"
#include <assert.h>
#include <string.h>
Go to the source code of this file.
Functions | |
linkedList_t * | LIST_Add (linkedList_t **listDest, const byte *data, size_t length) |
Adds an entry to a new or to an already existing linked list. | |
const linkedList_t * | LIST_ContainsString (const linkedList_t *list, const char *string) |
Searches for the first occurrence of a given string. | |
linkedList_t * | LIST_GetPointer (linkedList_t *list, const void *data) |
Searches for the first occurrence of a given string. | |
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. | |
void | LIST_AddPointer (linkedList_t **listDest, void *data) |
Adds just a pointer to a new or to an already existing linked list. | |
void | LIST_RemoveEntry (linkedList_t **list, linkedList_t *entry) |
Removes one entry from the linked list. | |
void | LIST_Delete (linkedList_t **list) |
void * | LIST_GetNext (linkedList_t *list, void *lastData) |
Linked list iterator. | |
qboolean | LIST_Remove (linkedList_t **list, const void *data) |
qboolean | LIST_IsEmpty (const linkedList_t *list) |
Checks whether the given list is empty. | |
int | LIST_Count (const linkedList_t *list) |
void * | LIST_GetLast (linkedList_t *list) |
Returns the last entry in the linked list. | |
void * | LIST_GetByIdx (linkedList_t *list, int index) |
Get an entry of a linked list by its index in the list. | |
Variables | |
struct memPool_s * | com_genericPool |
linkedList_t* LIST_Add | ( | linkedList_t ** | listDest, | |
const byte * | data, | |||
size_t | length | |||
) |
Adds an entry to a new or to an already existing linked list.
Definition at line 22 of file list.c.
References byte, linkedList_s::data, Mem_PoolAlloc, and linkedList_s::next.
Referenced by AB_BuildBase(), AB_LoadXML(), AIR_Add(), CL_DisplayHomebasePopup(), CL_ParseCities(), Com_ParseItem(), CP_CreateNewMission(), CP_LoadMissionsXML(), CP_ParseCharacterData(), HUD_PopupFiremodeReservation(), testLinkedList(), US_LoadXML(), and US_StoreUFO().
void LIST_AddPointer | ( | linkedList_t ** | listDest, | |
void * | data | |||
) |
Adds just a pointer to a new or to an already existing linked list.
Definition at line 128 of file list.c.
References byte, linkedList_s::data, Mem_PoolAlloc, linkedList_s::next, linkedList_s::ptr, and qtrue.
Referenced by AIR_AddToAircraftTeam(), AIR_LoadAircraftXML(), B_BuildingAddToList(), CL_GetEventMail(), Com_ParseItem(), E_EmployeeList_f(), E_GetHiredEmployees(), HUD_PopupFiremodeReservation(), PR_UpdateProductionList(), and RS_ParseTechnologies().
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.
Definition at line 96 of file list.c.
References byte, linkedList_s::data, Mem_PoolAlloc, Mem_StrDup, and linkedList_s::next.
Referenced by _AddToListBlock(), AIM_UpdateAircraftItemList(), AIR_AircraftUpdateList_f(), BDEF_AddSlotToSlotList(), BDEF_BaseDefenceMenuUpdate_f(), BDEF_UpdateAircraftItemList(), BS_AddToList(), CL_DisplayHomebasePopup(), CL_DisplayPopupInterceptMission(), CL_DisplayPopupInterceptUFO(), CL_ParseAlienTeam(), CL_ParseMapDefinition(), CL_ParseTeamInfoMessage(), CLMN_AddBindings(), Com_ParseActorModels(), Com_ParseActorNames(), Com_ParseActorSounds(), Com_ParseItem(), CP_ChooseNation(), GAME_CP_GetCampaigns_f(), HUD_PopupFiremodeReservation(), Irc_Client_Names_f(), MP_AddChatMessage(), PR_UpdateProductionList(), RS_ParseTechnologies(), Sys_ListFilteredFiles(), TR_CargoList(), TR_TransferSelect(), TUT_GetTutorials_f(), UI_ExecuteCallAction(), UI_MaterialEditorUpdate(), UI_TextNodeGenerateLineSplit(), UP_DisplayTechTree(), UR_DialogFillNations(), and UR_DialogInitStore_f().
const linkedList_t* LIST_ContainsString | ( | const linkedList_t * | list, | |
const char * | string | |||
) |
Searches for the first occurrence of a given string.
NULL
NULL
, the function returns NULL
Definition at line 58 of file list.c.
References linkedList_s::data, and linkedList_s::next.
Referenced by _AddToListBlock(), CP_MapIsSelectable(), GAME_MP_MapInfo(), MAP_PositionFitsTCPNTypes(), NAT_ScriptSanityCheck(), testLinkedList(), and UI_UpdateInvisOptions().
int LIST_Count | ( | const linkedList_t * | list | ) |
Definition at line 264 of file list.c.
References count, and linkedList_s::next.
Referenced by AB_GetAlienBaseNumber(), AIR_AircraftSelect(), AIR_GetTeamSize(), B_BaseInit_f(), B_BuildingAddToList(), B_BuildingInit(), BDEF_AddSlotToSlotList(), CP_BaseAttackStartMission(), E_GetHiredEmployees(), FS_BuildFileList(), HUD_PopupFiremodeReservation(), HUD_ShotReserve_f(), LIST_GetByIdx(), PR_ProductionType_f(), testLinkedList(), and US_StoredUFOCount().
void LIST_Delete | ( | linkedList_t ** | list | ) |
Definition at line 199 of file list.c.
References linkedList_s::data, Mem_Free, linkedList_s::next, next, and linkedList_s::ptr.
Referenced by AIR_ResetAircraftTeam(), B_SetUpBase(), CL_DisplayHomebasePopup(), CL_FreeDynamicEventMail(), CL_ResetSinglePlayerData(), Com_AddObjectLinks(), CP_BaseAttackStartMission(), CP_GetWinProbabilty(), CP_HarvestMissionGo(), CP_ParseCharacterData(), E_EmployeeList_f(), E_GetHiredEmployees(), E_GetHiredRobot(), FS_BuildFileList(), HUD_PopupFiremodeReservation(), PR_UpdateProductionList(), RS_RequiredLinksAssign(), RS_ResetTechs(), UI_ExecuteCallAction(), UI_ResetData(), and UI_TextNodeGenerateLineSplit().
void* LIST_GetByIdx | ( | linkedList_t * | list, | |
int | index | |||
) |
Get an entry of a linked list by its index in the list.
[in] | list | Linked list to get the entry from. |
[in] | index | The index of the entry in the linked list. |
Definition at line 298 of file list.c.
References count, linkedList_s::data, i, LIST_Count(), and linkedList_s::next.
Referenced by CP_ChooseCity(), E_GetEmployeeByMenuIndex(), HUD_ShotReserve_f(), PR_ProductionListClick_f(), PR_ProductionListRightClick_f(), PR_ProductionType_f(), and testLinkedList().
void* LIST_GetLast | ( | linkedList_t * | list | ) |
Returns the last entry in the linked list.
[in] | list | Linked list to get the entry from. |
Definition at line 280 of file list.c.
References linkedList_s::data, linkedList_s::next, and next.
void* LIST_GetNext | ( | linkedList_t * | list, | |
void * | lastData | |||
) |
Linked list iterator.
list | The linked list to iterate over | |
lastData | The last data entry |
Definition at line 219 of file list.c.
References linkedList_s::data, LIST_GetPointer(), LIST_IsEmpty(), and linkedList_s::next.
Referenced by AB_GetNext(), AIR_GetNextFromBase(), and US_GetNext().
linkedList_t* LIST_GetPointer | ( | linkedList_t * | list, | |
const void * | data | |||
) |
Searches for the first occurrence of a given string.
NULL
NULL
, the function returns NULL
Definition at line 77 of file list.c.
References linkedList_s::data, and linkedList_s::next.
Referenced by AIR_IsInAircraftTeam(), LIST_GetNext(), and LIST_Remove().
qboolean LIST_IsEmpty | ( | const linkedList_t * | list | ) |
Checks whether the given list is empty.
[in] | list | The linked list to check |
true
if empty, false
otherwise Definition at line 255 of file list.c.
Referenced by LIST_GetNext().
qboolean LIST_Remove | ( | linkedList_t ** | list, | |
const void * | data | |||
) |
Definition at line 242 of file list.c.
References LIST_GetPointer(), and LIST_RemoveEntry().
Referenced by AB_DestroyBase(), AIR_Delete(), and US_RemoveStoredUFO().
void LIST_RemoveEntry | ( | linkedList_t ** | list, | |
linkedList_t * | entry | |||
) |
Removes one entry from the linked list.
Definition at line 163 of file list.c.
References linkedList_s::data, Mem_Free, linkedList_s::next, and linkedList_s::ptr.
Referenced by AIR_RemoveFromAircraftTeam(), CP_MissionRemove(), LIST_Remove(), and testLinkedList().
struct memPool_s* com_genericPool |