@@ -334,10 +334,16 @@ } append(str, @selector(appendString:), [objs[i] description]); [pool release]; + /* + * Class swizzle the string to be immutable. We declared the return type + * to be OFString*, so it can't be modified anyway. But not swizzling it + * would create a real copy each time -[copy] is called. + */ + str->isa = [OFString class]; return str; } - (BOOL)isEqual: (id)obj { @@ -399,11 +405,19 @@ [ret release]; } [pool release]; - return [ret autorelease]; + [ret autorelease]; + + /* + * Class swizzle the string to be immutable. We declared the return type + * to be OFString*, so it can't be modified anyway. But not swizzling it + * would create a real copy each time -[copy] is called. + */ + ret->isa = [OFString class]; + return ret; } - (int)countByEnumeratingWithState: (of_fast_enumeration_state_t*)state objects: (id*)objects count: (int)count_