@@ -169,16 +169,12 @@ @throw [OFInvalidEncodingException newWithClass: isa]; [ret appendCString: string + last withLength: i - last]; - /* - * 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]; + [ret makeImmutable]; + return ret; } #ifdef OF_HAVE_BLOCKS - (OFString*)stringByXMLUnescapingWithBlock: @@ -267,15 +263,11 @@ @throw [OFInvalidEncodingException newWithClass: isa]; [ret appendCString: string + last withLength: i - last]; - /* - * 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]; + [ret makeImmutable]; + return ret; } #endif @end