Index: src/OFList.m ================================================================== --- src/OFList.m +++ src/OFList.m @@ -79,22 +79,27 @@ return self; } - (void)dealloc { + of_list_object_t *next; + for (of_list_object_t *iter = _firstListObject; - iter != NULL; iter = iter->next) + iter != NULL; iter = next) { [iter->object release]; + next = iter->next; + free(iter); + } [super dealloc]; } - (of_list_object_t *)appendObject: (id)object { of_list_object_t *listObject; - listObject = [self allocMemoryWithSize: sizeof(of_list_object_t)]; + listObject = of_malloc(1, sizeof(of_list_object_t)); listObject->object = [object retain]; listObject->next = NULL; listObject->previous = _lastListObject; if (_lastListObject != NULL) @@ -113,11 +118,11 @@ - (of_list_object_t *)prependObject: (id)object { of_list_object_t *listObject; - listObject = [self allocMemoryWithSize: sizeof(of_list_object_t)]; + listObject = of_malloc(1, sizeof(of_list_object_t)); listObject->object = [object retain]; listObject->next = _firstListObject; listObject->previous = NULL; if (_firstListObject != NULL) @@ -136,11 +141,11 @@ - (of_list_object_t *)insertObject: (id)object beforeListObject: (of_list_object_t *)listObject { of_list_object_t *newListObject; - newListObject = [self allocMemoryWithSize: sizeof(of_list_object_t)]; + newListObject = of_malloc(1, sizeof(of_list_object_t)); newListObject->object = [object retain]; newListObject->next = listObject; newListObject->previous = listObject->previous; if (listObject->previous != NULL) @@ -160,11 +165,11 @@ - (of_list_object_t *)insertObject: (id)object afterListObject: (of_list_object_t *)listObject { of_list_object_t *newListObject; - newListObject = [self allocMemoryWithSize: sizeof(of_list_object_t)]; + newListObject = of_malloc(1, sizeof(of_list_object_t)); newListObject->object = [object retain]; newListObject->next = listObject->next; newListObject->previous = listObject; if (listObject->next != NULL) @@ -195,12 +200,11 @@ _count--; _mutations++; [listObject->object release]; - - [self freeMemory: listObject]; + free(listObject); } - (id)firstObject { return (_firstListObject != NULL ? _firstListObject->object : nil); @@ -270,19 +274,19 @@ return false; } - (void)removeAllObjects { - of_list_object_t *iter, *next; + of_list_object_t *next; _mutations++; - for (iter = _firstListObject; iter != NULL; iter = next) { - next = iter->next; - + for (of_list_object_t *iter = _firstListObject; + iter != NULL; iter = next) { [iter->object release]; - [self freeMemory: iter]; + next = iter->next; + free(iter); } _firstListObject = _lastListObject = NULL; } @@ -295,12 +299,11 @@ previous = NULL; @try { for (of_list_object_t *iter = _firstListObject; iter != NULL; iter = iter->next) { - listObject = [copy allocMemoryWithSize: - sizeof(of_list_object_t)]; + listObject = of_malloc(1, sizeof(of_list_object_t)); listObject->object = [iter->object retain]; listObject->next = NULL; listObject->previous = previous; if (copy->_firstListObject == NULL)