Overview
| Comment: | OFXMLElement: Use more fast enumeration |
|---|---|
| Downloads: | Tarball | ZIP archive | SQL archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA3-256: |
a7c6add997b0b4c6e8ed0dc5c2ac6dbd |
| User & Date: | js on 2016-05-08 21:08:28 |
| Other Links: | manifest | tags |
Context
|
2016-05-08
| ||
| 21:31 | Fix super lookup of missing methods on SPARC64 (check-in: 074011b393 user: js tags: trunk) | |
| 21:08 | OFXMLElement: Use more fast enumeration (check-in: a7c6add997 user: js tags: trunk) | |
| 09:36 | Fix super lookup of missing methods on PPC (check-in: 7156752f97 user: js tags: trunk) | |
Changes
Modified src/OFXMLElement.m from [09fc7f39d0] to [0f84ad0d19].
| ︙ | ︙ | |||
423 424 425 426 427 428 429 |
- (OFString*)OF_XMLStringWithParent: (OFXMLElement*)parent
namespaces: (OFDictionary*)allNamespaces
indentation: (unsigned int)indentation
level: (unsigned int)level
{
void *pool;
char *cString;
| | < | 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 |
- (OFString*)OF_XMLStringWithParent: (OFXMLElement*)parent
namespaces: (OFDictionary*)allNamespaces
indentation: (unsigned int)indentation
level: (unsigned int)level
{
void *pool;
char *cString;
size_t length, i;
OFString *prefix, *parentPrefix;
OFString *ret;
OFString *defaultNS;
pool = objc_autoreleasePoolPush();
parentPrefix = [allNamespaces objectForKey:
(parent != nil && parent->_namespace != nil
|
| ︙ | ︙ | |||
514 515 516 517 518 519 520 | memcpy(cString + i, [_namespace UTF8String], [_namespace UTF8StringLength]); i += [_namespace UTF8StringLength]; cString[i++] = '\''; } /* Attributes */ | < < | < | | < | | | < | 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 |
memcpy(cString + i, [_namespace UTF8String],
[_namespace UTF8StringLength]);
i += [_namespace UTF8StringLength];
cString[i++] = '\'';
}
/* Attributes */
for (OFXMLAttribute *attribute in _attributes) {
void *pool2 = objc_autoreleasePoolPush();
OFString *attributeName = [attribute name];
OFString *attributePrefix = nil;
OFString *tmp = [[attribute stringValue] stringByXMLEscaping];
if ([attribute namespace] != nil &&
(attributePrefix = [allNamespaces objectForKey:
[attribute namespace]]) == nil)
@throw [OFUnboundNamespaceException
exceptionWithNamespace: [attribute namespace]
element: self];
length += [attributeName UTF8StringLength] +
(attributePrefix != nil ?
[attributePrefix UTF8StringLength] + 1 : 0) +
[tmp UTF8StringLength] + 4;
|
| ︙ | ︙ | |||
566 567 568 569 570 571 572 |
cString[i++] = '\'';
objc_autoreleasePoolPop(pool2);
}
/* Childen */
if (_children != nil) {
| < < < | | | | | < | | | | | | 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 |
cString[i++] = '\'';
objc_autoreleasePoolPop(pool2);
}
/* Childen */
if (_children != nil) {
OFDataArray *tmp = [OFDataArray dataArray];
bool indent;
if (indentation > 0) {
indent = true;
for (OFXMLNode *child in _children) {
if ([child isKindOfClass: charactersClass] ||
[child isKindOfClass: CDATAClass]) {
indent = false;
break;
}
}
} else
indent = false;
for (OFXMLNode *child in _children) {
OFString *childString;
unsigned int ind = (indent ? indentation : 0);
if (ind)
[tmp addItem: "\n"];
if ([child isKindOfClass: [OFXMLElement class]])
childString = [(OFXMLElement*)child
OF_XMLStringWithParent: self
namespaces: allNamespaces
indentation: ind
level: level + 1];
else
childString = [child
XMLStringWithIndentation: ind
level: level + 1];
[tmp addItems: [childString UTF8String]
count: [childString UTF8StringLength]];
}
if (indent)
[tmp addItem: "\n"];
length += [tmp count] + [_name UTF8StringLength] + 2 +
(indent ? level * indentation : 0);
|
| ︙ | ︙ |