@@ -999,10 +999,16 @@ OFMutableString *new; new = [OFMutableString stringWithString: self]; [new appendString: str]; + /* + * 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. + */ + new->isa = [OFString class]; return new; } - (BOOL)hasPrefix: (OFString*)prefix { @@ -1054,10 +1060,16 @@ } [array addObject: [OFString stringWithCString: string + last]]; [pool release]; + /* + * Class swizzle the array to be immutable. We declared the return type + * to be OFArray*, so it can't be modified anyway. But not swizzling it + * would create a real copy each time -[copy] is called. + */ + array->isa = [OFArray class]; return array; } - (intmax_t)decimalValue {