Differences From Artifact [baacfe9bd9]:
- File src/OFString+XMLUnescaping.m — part of check-in [57a6e8ef79] at 2013-03-30 20:07:08 on branch trunk — Improve code readability. (user: js, size: 6722) [annotate] [blame] [check-ins using]
To Artifact [1dff93e5a9]:
- File
src/OFString+XMLUnescaping.m
— part of check-in
[3d16a30f41]
at
2013-06-22 12:12:36
on branch trunk
— Rework exceptions.
This mostly removes the argument for the class in which the exception
occurred. As backtraces were recently added for all platforms, the
passed class does not give any extra information on where the exception
occurred anymore.This also removes a few other arguments which were not too helpful. In
the past, the idea was to pass as many arguments as possible so that it
is easier to find the origin of the exception. However, as backtraces
are a much better way to find the origin, those are not useful anymore
and just make the exception more cumbersome to use. The rule is now to
only pass arguments that might help in recovering from the exception or
provide information that is otherwise not easily accessible. (user: js, size: 6525) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
16 17 18 19 20 21 22 | #include "config.h" #include <string.h> #import "OFString.h" | | | 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | #include "config.h" #include <string.h> #import "OFString.h" #import "OFInvalidFormatException.h" #import "autorelease.h" #import "macros.h" int _OFString_XMLUnescaping_reference; static OF_INLINE OFString* |
︙ | ︙ | |||
135 136 137 138 139 140 141 | OFString *tmp; pool = objc_autoreleasePoolPush(); tmp = parse_numeric_entity(entity, entityLength); if (tmp == nil) | | | | | | < | < | 135 136 137 138 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 176 177 178 179 180 181 | OFString *tmp; pool = objc_autoreleasePoolPush(); tmp = parse_numeric_entity(entity, entityLength); if (tmp == nil) @throw [OFInvalidFormatException exception]; [ret appendString: tmp]; objc_autoreleasePoolPop(pool); } else if (delegate != nil) { void *pool; OFString *n, *tmp; pool = objc_autoreleasePoolPush(); n = [OFString stringWithUTF8String: entity length: entityLength]; tmp = [delegate string: self containsUnknownEntityNamed: n]; if (tmp == nil) @throw [OFInvalidFormatException exception]; [ret appendString: tmp]; objc_autoreleasePoolPop(pool); } else @throw [OFInvalidFormatException exception]; last = i + 1; inEntity = false; } } if (inEntity) @throw [OFInvalidFormatException exception]; [ret appendUTF8String: string + last length: i - last]; [ret makeImmutable]; return ret; |
︙ | ︙ | |||
238 239 240 241 242 243 244 | OFString *tmp; pool = objc_autoreleasePoolPush(); tmp = parse_numeric_entity(entity, entityLength); if (tmp == nil) | | | | | | < | 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 | OFString *tmp; pool = objc_autoreleasePoolPush(); tmp = parse_numeric_entity(entity, entityLength); if (tmp == nil) @throw [OFInvalidFormatException exception]; [ret appendString: tmp]; objc_autoreleasePoolPop(pool); } else { void *pool; OFString *entityString, *tmp; pool = objc_autoreleasePoolPush(); entityString = [OFString stringWithUTF8String: entity length: entityLength]; tmp = block(self, entityString); if (tmp == nil) @throw [OFInvalidFormatException exception]; [ret appendString: tmp]; objc_autoreleasePoolPop(pool); } last = i + 1; inEntity = false; } } if (inEntity) @throw [OFInvalidFormatException exception]; [ret appendUTF8String: string + last length: i - last]; [ret makeImmutable]; return ret; } #endif @end |