@@ -750,16 +750,12 @@ BOOL *stop) { [new setObject: block(key, object) forKey: key]; }]; - /* - * Class swizzle the dictionary to be immutable. We declared the return - * type to be OFDictionary*, so it can't be modified anyway. But not - * swizzling it would create a real copy each time -[copy] is called. - */ - new->isa = [OFDictionary class]; + [new makeImmutable]; + return new; } - (OFDictionary*)filteredDictionaryUsingBlock: (of_dictionary_filter_block_t)block @@ -771,16 +767,12 @@ if (block(key, object)) [new setObject: object forKey: key]; }]; - /* - * Class swizzle the dictionary to be immutable. We declared the return - * type to be OFDictionary*, so it can't be modified anyway. But not - * swizzling it would create a real copy each time -[copy] is called. - */ - new->isa = [OFDictionary class]; + [new makeImmutable]; + return new; } #endif - (void)dealloc @@ -857,18 +849,14 @@ } [ret replaceOccurrencesOfString: @"\n" withString: @"\n\t"]; [ret appendString: @";\n}"]; + [ret makeImmutable]; + [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. - */ - ret->isa = [OFString class]; return ret; } - (OFXMLElement*)XMLElementBySerializing {