Overview
Comment: | Add -[removeAllObjects] and -[removeAllItems]. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
d1572ef0368a45471545b0a7e2f48802 |
User & Date: | js on 2012-01-31 13:59:09 |
Other Links: | manifest | tags |
Context
2012-01-31
| ||
14:32 | Fix -[OFMutableString_UTF8 replaceCharactersInRange:withString:]. check-in: 607c862411 user: js tags: trunk | |
13:59 | Add -[removeAllObjects] and -[removeAllItems]. check-in: d1572ef036 user: js tags: trunk | |
13:55 | Remove forgotten debug output. check-in: 2fd13b0adf user: js tags: trunk | |
Changes
Modified src/OFDataArray.h from [6e22536050] to [f2dc48f29f].
︙ | ︙ | |||
235 236 237 238 239 240 241 242 243 244 245 246 247 248 | atIndex: (size_t)index; /** * \brief Removes the last item. */ - (void)removeLastItem; /** * \brief Returns a string containing the data in Base64 encoding. * * \return A string containing the data in Base64 encoding */ - (OFString*)stringByBase64Encoding; | > > > > > | 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 | atIndex: (size_t)index; /** * \brief Removes the last item. */ - (void)removeLastItem; /** * \brief Removes all items. */ - (void)removeAllItems; /** * \brief Returns a string containing the data in Base64 encoding. * * \return A string containing the data in Base64 encoding */ - (OFString*)stringByBase64Encoding; |
︙ | ︙ |
Modified src/OFDataArray.m from [8afbccd334] to [80fa284829].
︙ | ︙ | |||
356 357 358 359 360 361 362 363 364 365 366 367 368 369 | data = [self resizeMemory: data toNItems: count ofSize: itemSize]; } @catch (OFOutOfMemoryException *e) { /* We don't care, as we only made it smaller */ } } - copy { OFDataArray *copy = [[isa alloc] initWithItemSize: itemSize]; [copy addNItems: count fromCArray: data]; | > > > > > > > > | 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 | data = [self resizeMemory: data toNItems: count ofSize: itemSize]; } @catch (OFOutOfMemoryException *e) { /* We don't care, as we only made it smaller */ } } - (void)removeAllItems { [self freeMemory: data]; data = NULL; count = 0; } - copy { OFDataArray *copy = [[isa alloc] initWithItemSize: itemSize]; [copy addNItems: count fromCArray: data]; |
︙ | ︙ | |||
600 601 602 603 604 605 606 607 | } @catch (OFOutOfMemoryException *e) { /* We don't care, as we only made it smaller */ } size = newSize; } } @end | > > > > > > > > > | 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 | } @catch (OFOutOfMemoryException *e) { /* We don't care, as we only made it smaller */ } size = newSize; } } - (void)removeAllItems { [self freeMemory: data]; data = NULL; count = 0; size = 0; } @end |
Modified src/OFMutableArray.h from [66c505dbab] to [7347712143].
︙ | ︙ | |||
107 108 109 110 111 112 113 114 115 116 117 118 119 120 | - (void)removeObjectsInRange: (of_range_t)range; /** * \brief Removes the last object. */ - (void)removeLastObject; #ifdef OF_HAVE_BLOCKS /** * \brief Replaces each object with the object returned by the block. * * \param block The block which returns a new object for each object */ - (void)replaceObjectsUsingBlock: (of_array_replace_block_t)block; | > > > > > | 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 | - (void)removeObjectsInRange: (of_range_t)range; /** * \brief Removes the last object. */ - (void)removeLastObject; /** * \brief Removes all objects. */ - (void)removeAllObjects; #ifdef OF_HAVE_BLOCKS /** * \brief Replaces each object with the object returned by the block. * * \param block The block which returns a new object for each object */ - (void)replaceObjectsUsingBlock: (of_array_replace_block_t)block; |
︙ | ︙ |
Modified src/OFMutableArray.m from [fdde418d40] to [46ae62e754].
︙ | ︙ | |||
276 277 278 279 280 281 282 283 284 285 286 287 288 289 | [self removeObjectAtIndex: range.start]; } - (void)removeLastObject { [self removeNObjects: 1]; } #ifdef OF_HAVE_BLOCKS - (void)replaceObjectsUsingBlock: (of_array_replace_block_t)block { [self enumerateObjectsUsingBlock: ^ (id object, size_t index, BOOL *stop) { [self replaceObjectAtIndex: index | > > > > > | 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 | [self removeObjectAtIndex: range.start]; } - (void)removeLastObject { [self removeNObjects: 1]; } - (void)removeAllObjects { [self removeNObjects: [self count]]; } #ifdef OF_HAVE_BLOCKS - (void)replaceObjectsUsingBlock: (of_array_replace_block_t)block { [self enumerateObjectsUsingBlock: ^ (id object, size_t index, BOOL *stop) { [self replaceObjectAtIndex: index |
︙ | ︙ |
Modified src/OFMutableArray_adjacent.m from [397d9a1a3d] to [e02a8ee9e6].
︙ | ︙ | |||
163 164 165 166 167 168 169 170 171 172 173 174 175 176 | for (i = 0; i < nObjects; i++) [copy[i] release]; } @finally { [self freeMemory: copy]; } } - (void)removeObjectsInRange: (of_range_t)range { id *cArray = [array cArray], *copy; size_t i, count = [array count]; if (range.length > count - range.start) | > > > > > > > > > > > | 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 | for (i = 0; i < nObjects; i++) [copy[i] release]; } @finally { [self freeMemory: copy]; } } - (void)removeAllObjects { id *cArray = [array cArray]; size_t i, count = [array count]; for (i = 0; i < count; i++) [cArray[i] release]; [array removeAllItems]; } - (void)removeObjectsInRange: (of_range_t)range { id *cArray = [array cArray], *copy; size_t i, count = [array count]; if (range.length > count - range.start) |
︙ | ︙ |
Modified src/OFXMLParser.m from [14f7ba420b] to [768dfa63ad].
︙ | ︙ | |||
328 329 330 331 332 333 334 | [delegate parser: self foundCharacters: characters]; [pool release]; } | | | 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 | [delegate parser: self foundCharacters: characters]; [pool release]; } [cache removeAllItems]; *last = *i + 1; state = OF_XMLPARSER_TAG_OPENED; } /* Tag was just opened */ - (void)_parseTagOpenedWithBuffer: (const char*)buffer |
︙ | ︙ | |||
490 491 492 493 494 495 496 | parser: self]; [delegate parser: self foundProcessingInstructions: pi]; [pool release]; | | | 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 | parser: self]; [delegate parser: self foundProcessingInstructions: pi]; [pool release]; [cache removeAllItems]; *last = *i + 1; state = OF_XMLPARSER_OUTSIDE_TAG; } else level = 0; } |
︙ | ︙ | |||
584 585 586 587 588 589 590 | if (buffer[*i] != '/') { pool = [[OFAutoreleasePool alloc] init]; [namespaces addObject: [OFMutableDictionary dictionary]]; [pool release]; } | | | 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 | if (buffer[*i] != '/') { pool = [[OFAutoreleasePool alloc] init]; [namespaces addObject: [OFMutableDictionary dictionary]]; [pool release]; } [cache removeAllItems]; *last = *i + 1; } /* Inside a close tag, no name yet */ - (void)_parseInCloseTagNameWithBuffer: (const char*)buffer i: (size_t*)i last: (size_t*)last |
︙ | ︙ | |||
631 632 633 634 635 636 637 | if (![[previous lastObject] isEqual: cacheString]) @throw [OFMalformedXMLException exceptionWithClass: isa parser: self]; [previous removeLastObject]; | | | 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 | if (![[previous lastObject] isEqual: cacheString]) @throw [OFMalformedXMLException exceptionWithClass: isa parser: self]; [previous removeLastObject]; [cache removeAllItems]; ns = namespace_for_prefix(prefix, namespaces); if (prefix != nil && ns == nil) @throw [OFUnboundNamespaceException exceptionWithClass: isa prefix: prefix]; [delegate parser: self |
︙ | ︙ | |||
773 774 775 776 777 778 779 | } else { attributeName = [cacheString copy]; attributePrefix = nil; } [pool release]; | | | 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 | } else { attributeName = [cacheString copy]; attributePrefix = nil; } [pool release]; [cache removeAllItems]; *last = *i + 1; state = OF_XMLPARSER_EXPECT_DELIM; } /* Expecting delimiter */ - (void)_parseExpectDelimiterWithBuffer: (const char*)buffer |
︙ | ︙ | |||
833 834 835 836 837 838 839 | [attributes addObject: [OFXMLAttribute attributeWithName: attributeName namespace: attributePrefix stringValue: attributeValue]]; [pool release]; | | | 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 | [attributes addObject: [OFXMLAttribute attributeWithName: attributeName namespace: attributePrefix stringValue: attributeValue]]; [pool release]; [cache removeAllItems]; [attributeName release]; [attributePrefix release]; attributeName = attributePrefix = nil; *last = *i + 1; state = OF_XMLPARSER_IN_TAG; } |
︙ | ︙ | |||
947 948 949 950 951 952 953 | CDATA = transform_string(cache, 2, NO, nil); [delegate parser: self foundCDATA: CDATA]; [pool release]; | | | 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 | CDATA = transform_string(cache, 2, NO, nil); [delegate parser: self foundCDATA: CDATA]; [pool release]; [cache removeAllItems]; *last = *i + 1; state = OF_XMLPARSER_OUTSIDE_TAG; } /* Comment */ - (void)_parseInCommentOpeningWithBuffer: (const char*)buffer |
︙ | ︙ | |||
1001 1002 1003 1004 1005 1006 1007 | comment = transform_string(cache, 2, NO, nil); [delegate parser: self foundComment: comment]; [pool release]; | | | 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 | comment = transform_string(cache, 2, NO, nil); [delegate parser: self foundComment: comment]; [pool release]; [cache removeAllItems]; *last = *i + 1; state = OF_XMLPARSER_OUTSIDE_TAG; } /* In <!DOCTYPE ...> */ - (void)_parseInDoctypeWithBuffer: (const char*)buffer |
︙ | ︙ |