@@ -1034,17 +1034,11 @@ for (i = 0; i < count; i++) if (cArray[i]->name != nil) [ret addObject: cArray[i]]; - /* - * 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. - */ - ret->isa = [OFArray class]; - return ret; + return [ret makeImmutable]; } - (OFArray*)elementsForName: (OFString*)elementName { OFMutableArray *ret = [OFMutableArray array]; @@ -1054,17 +1048,11 @@ for (i = 0; i < count; i++) if (cArray[i]->ns == nil && [cArray[i]->name isEqual: elementName]) [ret addObject: cArray[i]]; - /* - * 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. - */ - ret->isa = [OFArray class]; - return ret; + return [ret makeImmutable]; } - (OFArray*)elementsForNamespace: (OFString*)elementNS { OFMutableArray *ret = [OFMutableArray array]; @@ -1074,17 +1062,11 @@ for (i = 0; i < count; i++) if (cArray[i]->name != nil && [cArray[i]->ns isEqual: elementNS]) [ret addObject: cArray[i]]; - /* - * 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. - */ - ret->isa = [OFArray class]; - return ret; + return [ret makeImmutable]; } - (OFArray*)elementsForName: (OFString*)elementName namespace: (OFString*)elementNS { @@ -1102,17 +1084,11 @@ for (i = 0; i < count; i++) if ([cArray[i]->ns isEqual: elementNS] && [cArray[i]->name isEqual: elementName]) [ret addObject: cArray[i]]; - /* - * 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. - */ - ret->isa = [OFArray class]; - return ret; + return [ret makeImmutable]; } - (BOOL)isEqual: (id)object { OFXMLElement *otherElement;