Differences From Artifact [7b80c238f7]:
- File src/OFArray.m — part of check-in [ee77d91252] at 2011-09-10 17:36:30 on branch trunk — We can safely assume fast enumeration if we have blocks. (user: js, size: 12954) [annotate] [blame] [check-ins using]
To Artifact [de78bb7da7]:
- File
src/OFArray.m
— part of check-in
[9e0ca2f627]
at
2011-09-11 12:15:55
on branch trunk
— Add OFArray_subarray and OFArray_adjacenSubarray.
These will prevent a copy of an immutable array when using
-[objectsInRange:]. (user: js, size: 13117) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
15 16 17 18 19 20 21 22 23 24 25 26 27 28 | */ #include "config.h" #include <stdarg.h> #import "OFArray.h" #import "OFArray_adjacent.h" #import "OFString.h" #import "OFXMLElement.h" #import "OFAutoreleasePool.h" #import "OFEnumerationMutationException.h" #import "OFInvalidArgumentException.h" | > | 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | */ #include "config.h" #include <stdarg.h> #import "OFArray.h" #import "OFArray_subarray.h" #import "OFArray_adjacent.h" #import "OFString.h" #import "OFXMLElement.h" #import "OFAutoreleasePool.h" #import "OFEnumerationMutationException.h" #import "OFInvalidArgumentException.h" |
︙ | ︙ | |||
334 335 336 337 338 339 340 | return nil; } - (OFArray*)objectsInRange: (of_range_t)range { OFArray *ret; | > > > > > > | | 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 | return nil; } - (OFArray*)objectsInRange: (of_range_t)range { OFArray *ret; id *buffer; if (![self isKindOfClass: [OFMutableArray class]]) return [OFArray_subarray arrayWithArray: self range: range]; buffer = [self allocMemoryForNItems: range.length withSize: sizeof(*buffer)]; @try { [self getObjects: buffer inRange: range]; ret = [OFArray arrayWithCArray: buffer |
︙ | ︙ |