Index: src/OFList.h ================================================================== --- src/OFList.h +++ src/OFList.h @@ -151,10 +151,15 @@ * reasons! * * \return The last object of the list or nil */ - (id)lastObject; + +/** + * \brief Removes all objects from the list. + */ +- (void)removeAllObjects; @end @interface OFListEnumerator: OFEnumerator { OFList *list; Index: src/OFList.m ================================================================== --- src/OFList.m +++ src/OFList.m @@ -266,10 +266,26 @@ if (iter->object == object) return YES; return NO; } + +- (void)removeAllObjects +{ + of_list_object_t *iter, *next; + + mutations++; + + for (iter = firstListObject; iter != NULL; iter = next) { + next = iter->next; + + [iter->object release]; + [self freeMemory: iter]; + } + + firstListObject = lastListObject = NULL; +} - copy { OFList *copy = [[[self class] alloc] init]; of_list_object_t *iter, *listObject, *previous; Index: src/OFNumber.m ================================================================== --- src/OFNumber.m +++ src/OFNumber.m @@ -942,11 +942,12 @@ { OFNumber *number; if (![object isKindOfClass: [OFNumber class]]) @throw [OFInvalidArgumentException - exceptionWithClass: [self class]]; + exceptionWithClass: [self class] + selector: _cmd]; number = object; if (type & OF_NUMBER_FLOAT || number->type & OF_NUMBER_FLOAT) { double double1 = [self doubleValue]; Index: src/OFSortedList.m ================================================================== --- src/OFSortedList.m +++ src/OFSortedList.m @@ -11,10 +11,12 @@ * Alternatively, it may be distributed under the terms of the GNU General * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ + +#include "config.h" #import "OFSortedList.h" #import "OFNotImplementedException.h"