Differences From Artifact [570cb9f649]:
- File src/OFXMLElement+Serialization.m — part of check-in [ce70e17b38] at 2012-01-05 00:56:18 on branch trunk — Update copyright. (user: js, size: 1490) [annotate] [blame] [check-ins using]
To Artifact [2f13ccd9ab]:
- File
src/OFXMLElement+Serialization.m
— part of check-in
[1255f3a11a]
at
2012-08-10 20:08:24
on branch trunk
— Directly use the runtime's autorelease pools.
This greatly improves performance, as it gets rid of the overhead of
OFAutoreleasePool. (user: js, size: 1472) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
16 17 18 19 20 21 22 | #include "config.h" #import "OFXMLElement.h" #import "OFXMLElement+Serialization.h" #import "OFSerialization.h" #import "OFString.h" | < > | < < | | 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | #include "config.h" #import "OFXMLElement.h" #import "OFXMLElement+Serialization.h" #import "OFSerialization.h" #import "OFString.h" #import "OFInvalidArgumentException.h" #import "OFNotImplementedException.h" #import "autorelease.h" #import "macros.h" int _OFXMLElement_Serialization_reference; @implementation OFXMLElement (Serialization) - (id)objectByDeserializing { void *pool = objc_autoreleasePoolPush(); Class class; id object; if ((class = objc_lookUpClass([name cStringWithEncoding: OF_STRING_ENCODING_ASCII])) == Nil) @throw [OFNotImplementedException exceptionWithClass: Nil]; if (![class conformsToProtocol: @protocol(OFSerialization)]) @throw [OFNotImplementedException exceptionWithClass: class selector: @selector(initWithSerialization:)]; object = [[class alloc] initWithSerialization: self]; objc_autoreleasePoolPop(pool); return [object autorelease]; } @end |