9#include "../include/cLinkedList.h"
10#include "../include/macrodef.h"
30 fprintf(
ERRSTREAM,
"cLinkedList (cListLength): WARNING - Quashed attempt to access NULL pointer.\n");
46 fprintf(
ERRSTREAM,
"cLinkedList (cListEmpty): WARNING - Quashed attempt to access NULL pointer.\n");
69 fprintf(
ERRSTREAM,
"cLinkedList (cListFirstElem): WARNING - Quashed attempt to access NULL pointer.\n");
86 fprintf(
ERRSTREAM,
"cLinkedList (cListLastElem): WARNING - Quashed attempt to access NULL pointer.\n");
103 if (myList ==
NULL || myElem ==
NULL) {
105 fprintf(
ERRSTREAM,
"cLinkedList (cListNextElem): WARNING - Quashed attempt to access NULL pointer.\n");
124 if (myList ==
NULL || myElem ==
NULL) {
126 fprintf(
ERRSTREAM,
"cLinkedList (cListPrevElem): WARNING - Quashed attempt to access NULL pointer.\n");
147 if (myList ==
NULL) {
148 fprintf(
ERRSTREAM,
"cLinkedList (cListFindElem): WARNING - Quashed attempt to access NULL pointer.\n");
153 if (myElem->
obj == myData) {
173 if (myList ==
NULL) {
174 fprintf(
ERRSTREAM,
"cLinkedList (cListFindData): WARNING - Quashed attempt to access NULL pointer.\n");
194 if (myList ==
NULL) {
195 fprintf(
ERRSTREAM,
"cLinkedList (cListFirstData): WARNING - Quashed attempt to access NULL pointer.\n");
215 if (myList ==
NULL) {
216 fprintf(
ERRSTREAM,
"cLinkedList (cListLastData): WARNING - Quashed attempt to access NULL pointer.\n");
238 if (myList ==
NULL) {
239 fprintf(
ERRSTREAM,
"cLinkedList (cListNextData): WARNING - Quashed attempt to access NULL pointer.\n");
260 if (myList ==
NULL) {
261 fprintf(
ERRSTREAM,
"cLinkedList (cListPrevData): WARNING - Quashed attempt to access NULL pointer.\n");
284 if (myList ==
NULL) {
285 fprintf(
ERRSTREAM,
"cLinkedList (cListInit): WARNING - Quashed attempt to access NULL pointer.\n");
309 if (myList ==
NULL) {
310 fprintf(
ERRSTREAM,
"cLinkedList (cListInsertAfter): WARNING - Quashed attempt to access NULL pointer.\n");
322 (elem->
nextElem)->prevElem = newElem;
325 newElem->
obj = newData;
341 if (myList ==
NULL) {
342 fprintf(
ERRSTREAM,
"cLinkedList (cListInsertAfter): WARNING - Quashed attempt to access NULL pointer.\n");
354 (elem->
prevElem)->nextElem = newElem;
357 newElem->
obj = newData;
406 }
else if (delElem ==
NULL) {
407 fprintf(
ERRSTREAM,
"cListUnlinkElem (cLinkedList): WARNING - Quashed attempt to de-reference a NULL pointer!\n");
409 fprintf(
ERRSTREAM,
"cListUnlinkElem (cLinkedList): WARNING - Quashed attempt to access empty linked list.\n");
429 while (elem !=
NULL) {
int cListAppend(cLinkedList *myList, void *newData)
Append a data point into a linked list.
cListElem * cListNextElem(cLinkedList *myList, cListElem *myElem)
Returns the next element of a linked list when provided an element from the list.
void * cListLastData(cLinkedList *myList)
Returns the last data point of a linked list.
void * cListFirstData(cLinkedList *myList)
Returns the first data point of a linked list.
int cListEmpty(cLinkedList *myList)
cListElem * cListFindElem(cLinkedList *myList, void *myData)
Find an element in a linked list passed using the data linked in it.
void * cListFindData(cLinkedList *myList, void *myData)
Find a data point in a linked list if it is present.
cListElem * cListFirstElem(cLinkedList *myList)
Returns the first element of a linked list.
void * cListPrevData(cLinkedList *myList, void *myData)
Returns the previous data point of a linked list, when provided a data point from the list.
cListElem * cListPrevElem(cLinkedList *myList, cListElem *myElem)
Returns the previous element of a linked list, when provided an element from the list.
int cListInsertAfter(cLinkedList *myList, void *newData, cListElem *elem)
Insert a data point into a linked list after an existing element in the list.
unsigned long cListLength(cLinkedList *myList)
int cListInsertBefore(cLinkedList *myList, void *newData, cListElem *elem)
Insert a data point into a linked list before an existing element in the list.
void cListUnlinkElem(cLinkedList *myList, cListElem *delElem)
Unlinks an element from a linked list. This does not remove the actual data point linked.
void * cListNextData(cLinkedList *myList, void *myData)
Returns the next data point of a linked list when provided a data point from the list.
void cListUnlinkData(cLinkedList *delList, void *delData)
Unlinks a data point that is linked in a linked list.
cListElem * cListLastElem(cLinkedList *myList)
Returns the last element of a linked list.
void cListUnlinkAll(cLinkedList *myList)
Unlinks all the elements from a linked list. This does not remove the actual data points linked.
int cListInit(cLinkedList *myList)
Initializes a doubly linked list.
int cListPrepend(cLinkedList *myList, void *newData)
Prepend a data point into a linked list.
struct _cListElem * prevElem
struct _cListElem * nextElem