Differences From Artifact [9f7e711096]:
- File src/OFXMLAttribute.m — part of check-in [8892ae9fcc] at 2012-07-12 01:28:46 on branch trunk — Don't access isa directly. (user: js, size: 3533) [annotate] [blame] [check-ins using]
To Artifact [3e96efbf3c]:
- File
src/OFXMLAttribute.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: 3510) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
16 17 18 19 20 21 22 | #include "config.h" #import "OFXMLAttribute.h" #import "OFString.h" #import "OFDictionary.h" #import "OFXMLElement.h" | < > | 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | #include "config.h" #import "OFXMLAttribute.h" #import "OFString.h" #import "OFDictionary.h" #import "OFXMLElement.h" #import "OFInvalidArgumentException.h" #import "autorelease.h" #import "macros.h" @implementation OFXMLAttribute + attributeWithName: (OFString*)name namespace: (OFString*)ns stringValue: (OFString*)value { |
︙ | ︙ | |||
55 56 57 58 59 60 61 | } - initWithSerialization: (OFXMLElement*)element { self = [super init]; @try { | | | | 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | } - initWithSerialization: (OFXMLElement*)element { self = [super init]; @try { void *pool = objc_autoreleasePoolPush(); if (![[element name] isEqual: [self className]] || ![[element namespace] isEqual: OF_SERIALIZATION_NS]) @throw [OFInvalidArgumentException exceptionWithClass: [self class] selector: _cmd]; name = [[[element attributeForName: @"name"] stringValue] copy]; ns = [[[element attributeForName: @"namespace"] stringValue] copy]; stringValue = [[[element attributeForName: @"stringValue"] stringValue] copy]; objc_autoreleasePoolPop(pool); } @catch (id e) { [self release]; @throw e; } return self; } |
︙ | ︙ | |||
139 140 141 142 143 144 145 | OF_HASH_FINALIZE(hash); return hash; } - (OFXMLElement*)XMLElementBySerializing { | | | | | | 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 | OF_HASH_FINALIZE(hash); return hash; } - (OFXMLElement*)XMLElementBySerializing { void *pool = objc_autoreleasePoolPush(); OFXMLElement *element; element = [OFXMLElement elementWithName: [self className] namespace: OF_SERIALIZATION_NS]; [element addAttributeWithName: @"name" stringValue: name]; if (ns != nil) [element addAttributeWithName: @"namespace" stringValue: ns]; [element addAttributeWithName: @"stringValue" stringValue: stringValue]; [element retain]; objc_autoreleasePoolPop(pool); return [element autorelease]; } - (OFString*)description { return [OFString stringWithFormat: @"<OFXMLAttribute, name=%@, " @"namespace=%@, stringValue=%@>", name, ns, stringValue]; } @end |