Differences From Artifact [3b7a88e4d4]:
- File
src/OFArray.m
— part of check-in
[d4b379485a]
at
2010-07-08 08:57:00
on branch trunk
— Don't retain + autorelease objects returned from collections.
This increases performance and should not need to be handled by the
programmer in most cases. (user: js, size: 6591) [annotate] [blame] [check-ins using]
To Artifact [9bd99c7ed0]:
- File src/OFArray.m — part of check-in [c5d65603d8] at 2010-08-28 18:54:35 on branch trunk — Initial support for blocks. (user: js, size: 6843) [annotate] [blame] [check-ins using]
| ︙ | ︙ | |||
207 208 209 210 211 212 213 |
[objs[i] retain];
return new;
}
- (id)objectAtIndex: (size_t)index
{
| | | 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 |
[objs[i] retain];
return new;
}
- (id)objectAtIndex: (size_t)index
{
return *((id*)[array itemAtIndex: index]);
}
- (size_t)indexOfObject: (OFObject*)obj
{
id *objs = [array cArray];
size_t i, count = [array count];
|
| ︙ | ︙ | |||
346 347 348 349 350 351 352 353 354 355 356 357 358 359 |
- (OFEnumerator*)enumerator
{
return [[[OFArrayEnumerator alloc]
initWithDataArray: array
mutationsPointer: NULL] autorelease];
}
- (void)dealloc
{
OFObject **objs = [array cArray];
size_t i, count = [array count];
for (i = 0; i < count; i++)
| > > > > > > > > > > > > | 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 |
- (OFEnumerator*)enumerator
{
return [[[OFArrayEnumerator alloc]
initWithDataArray: array
mutationsPointer: NULL] autorelease];
}
#ifdef OF_HAVE_BLOCKS
- (void)enumerateObjectsUsingBlock: (of_array_enumeration_block_t)block
{
OFObject **objs = [array cArray];
size_t i, count = [array count];
BOOL stop = NO;
for (i = 0; i < count && !stop; i++)
block(objs[i], i, &stop);
}
#endif
- (void)dealloc
{
OFObject **objs = [array cArray];
size_t i, count = [array count];
for (i = 0; i < count; i++)
|
| ︙ | ︙ |