Differences From Artifact [fdc1d789a4]:
- File src/OFString+Serialization.m — part of check-in [96de96bbf6] at 2012-08-04 10:29:28 on branch trunk — Add missing include. (user: js, size: 2183) [annotate] [blame] [check-ins using]
To Artifact [6b475d1780]:
- File
src/OFString+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: 2156) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
18 19 20 21 22 23 24 | #import "OFString.h" #import "OFString+Serialization.h" #import "OFSerialization.h" #import "OFArray.h" #import "OFXMLElement.h" #import "OFXMLAttribute.h" | < > > | | 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 | #import "OFString.h" #import "OFString+Serialization.h" #import "OFSerialization.h" #import "OFArray.h" #import "OFXMLElement.h" #import "OFXMLAttribute.h" #import "OFInvalidArgumentException.h" #import "OFMalformedXMLException.h" #import "OFUnboundNamespaceException.h" #import "OFUnsupportedVersionException.h" #import "autorelease.h" int _OFString_Serialization_reference; @implementation OFString (Serialization) - (id)objectByDeserializing { void *pool = objc_autoreleasePoolPush(); OFXMLElement *root; OFString *version; OFArray *elements; id object; @try { root = [OFXMLElement elementWithXMLString: self]; |
︙ | ︙ | |||
66 67 68 69 70 71 72 | elements = [root elementsForNamespace: OF_SERIALIZATION_NS]; if ([elements count] != 1) @throw [OFInvalidArgumentException exceptionWithClass: [self class] selector: _cmd]; | | < < | | | 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | elements = [root elementsForNamespace: OF_SERIALIZATION_NS]; if ([elements count] != 1) @throw [OFInvalidArgumentException exceptionWithClass: [self class] selector: _cmd]; object = [[[elements firstObject] objectByDeserializing] retain]; objc_autoreleasePoolPop(pool); return [object autorelease]; } @end |