inline CCUnitList* ccunit_newList ()
{
CCUnitList* newList = calloc (1, sizeof (*newList));
+ if (!newList)
+ return NULL;
ccunit_initList (newList);
newList->isAllocated = true;
return newList;
void ccunit_addList (CCUnitList* list, void* contents)
{
- CCUnitListCell* cell = ccunit_newListCell ();
+ CCUnitListCell* cell;
+ if (!list)
+ return;
+ cell = ccunit_newListCell ();
+ if (!cell)
+ return;
cell->contents = contents;
cell->next = NULL;
*list->tailp = cell;
CCUnitListIterator* ccunit_newListIterator (const struct CCUnitList* list)
{
- CCUnitListIterator* it = calloc (1, sizeof (*it));
+ CCUnitListIterator* it;
+ if (!list)
+ return NULL;
+ it = calloc (1, sizeof (*it));
+ if (!it)
+ return NULL;
ccunit_initListIterator (list, it);
it->isAllocated = true;
return it;