Differences From Artifact [7b02ea3041]:
- File src/OFXMLParser.m — part of check-in [8523d20555] at 2011-10-11 22:13:23 on branch trunk — Small optimization in OFXMLParser. (user: js, size: 25215) [annotate] [blame] [check-ins using]
To Artifact [e2b24f34eb]:
- File
src/OFXMLParser.m
— part of check-in
[8953d826b4]
at
2011-10-11 22:21:16
on branch trunk
— More OFXMLParser optimizations.
With the last few commits, OFXMLParser is now twice as fast as before. (user: js, size: 25478) [annotate] [blame] [check-ins using]
| ︙ | ︙ | |||
60 61 62 63 64 65 66 |
}
}
static OFString*
transform_string(OFDataArray *cache, size_t cut, BOOL unescape,
OFObject <OFStringXMLUnescapingDelegate> *delegate)
{
| > > > | > | | > > > > > | > | > > > > > | | > | | 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 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
}
}
static OFString*
transform_string(OFDataArray *cache, size_t cut, BOOL unescape,
OFObject <OFStringXMLUnescapingDelegate> *delegate)
{
char *cArray;
size_t i, length;
BOOL hasEntities = NO;
OFMutableString *ret;
cArray = [cache cArray];
length = [cache count] - cut;
for (i = 0; i < length; i++) {
if (cArray[i] == '\r') {
if (i + 1 < length && cArray[i + 1] == '\n') {
[cache removeItemAtIndex: i];
cArray = [cache cArray];
i--;
length--;
} else
cArray[i] = '\n';
} else if (cArray[i] == '&')
hasEntities = YES;
}
ret = [OFMutableString stringWithUTF8String: cArray
length: length];
if (unescape && hasEntities)
return [ret stringByXMLUnescapingWithDelegate: delegate];
[ret makeImmutable];
return ret;
}
|
| ︙ | ︙ |