@@ -50,16 +50,16 @@ [iter->object release]; [super dealloc]; } -- (of_list_object_t*)firstListObject; +- (of_list_object_t*)firstListObject { return firstListObject; } -- (of_list_object_t*)lastListObject; +- (of_list_object_t*)lastListObject { return lastListObject; } - (of_list_object_t*)appendObject: (id)obj @@ -79,12 +79,10 @@ firstListObject = o; count++; mutations++; - [obj retain]; - return o; } - (of_list_object_t*)prependObject: (id)obj { @@ -103,12 +101,10 @@ lastListObject = o; count++; mutations++; - [obj retain]; - return o; } - (of_list_object_t*)insertObject: (id)obj beforeListObject: (of_list_object_t*)listobj @@ -129,12 +125,10 @@ firstListObject = o; count++; mutations++; - [obj retain]; - return o; } - (of_list_object_t*)insertObject: (id)obj afterListObject: (of_list_object_t*)listobj @@ -155,12 +149,10 @@ lastListObject = o; count++; mutations++; - [obj retain]; - return o; } - (void)removeListObject: (of_list_object_t*)listobj { @@ -257,12 +249,10 @@ if (prev != NULL) prev->next = o; new->count++; - [o->object retain]; - prev = o; } } @catch (id e) { [new release]; @throw e; @@ -294,14 +284,18 @@ return hash; } - (OFString*)description { - OFMutableString *ret = [OFMutableString stringWithString: @"[\n"]; + OFMutableString *ret; OFAutoreleasePool *pool; of_list_object_t *iter; + if (count == 0) + return @"[]"; + + ret = [OFMutableString stringWithString: @"[\n"]; pool = [[OFAutoreleasePool alloc] init]; for (iter = firstListObject; iter != NULL; iter = iter->next) { [ret appendString: [iter->object description]]; @@ -356,11 +350,11 @@ } @end @implementation OFListEnumerator - initWithList: (OFList*)list_ - mutationsPointer: (unsigned long*)mutationsPtr_; + mutationsPointer: (unsigned long*)mutationsPtr_ { self = [super init]; list = [list_ retain]; current = [list firstListObject];