Index: src/OFArray.m ================================================================== --- src/OFArray.m +++ src/OFArray.m @@ -167,11 +167,11 @@ return new; } - (id)objectAtIndex: (size_t)index { - return *((OFObject**)[array itemAtIndex: index]); + return [[*((OFObject**)[array itemAtIndex: index]) retain] autorelease]; } - (size_t)indexOfObject: (OFObject*)obj { id *objs = [array cArray]; @@ -204,18 +204,18 @@ - (id)firstObject { id *first = [array firstItem]; - return (first != NULL ? *first : nil); + return (first != NULL ? [[*first retain] autorelease] : nil); } - (id)lastObject { id *last = [array lastItem]; - return (last != NULL ? *last : nil); + return (last != NULL ? [[*last retain] autorelease] : nil); } - (OFString*)componentsJoinedByString: (OFString*)separator { OFString *str; @@ -222,27 +222,22 @@ OFString **objs = [array cArray]; size_t i, count = [array count]; IMP append; if (count == 0) - return [OFString string]; - - str = [[OFMutableString alloc] init]; - @try { - append = [str methodForSelector: @selector(appendString:)]; - - for (i = 0; i < count - 1; i++) { - append(str, @selector(appendString:), objs[i]); - append(str, @selector(appendString:), separator); - } - append(str, @selector(appendString:), objs[i]); - } @catch (OFException *e) { - [str release]; - @throw e; - } - - return [str autorelease]; + return @""; + + str = [OFMutableString string]; + append = [str methodForSelector: @selector(appendString:)]; + + for (i = 0; i < count - 1; i++) { + append(str, @selector(appendString:), objs[i]); + append(str, @selector(appendString:), separator); + } + append(str, @selector(appendString:), objs[i]); + + return str; } - (BOOL)isEqual: (OFObject*)obj { OFObject **objs, **objs2; Index: src/OFDictionary.m ================================================================== --- src/OFDictionary.m +++ src/OFDictionary.m @@ -473,11 +473,11 @@ /* Key not in dictionary */ if (i >= size || ![data[i].key isEqual: key]) return nil; - return data[i].object; + return [[data[i].object retain] autorelease]; } - (size_t)count { return count;