Overview
Comment: | Create an autorelease pool before calling blocks. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
44f8152a0341813fea741f949978c228 |
User & Date: | js on 2011-03-11 12:29:38 |
Other Links: | manifest | tags |
Context
2011-03-11
| ||
13:02 | Make it easier to generate getters and setters. check-in: 2c72efb4e7 user: js tags: trunk | |
12:29 | Create an autorelease pool before calling blocks. check-in: 44f8152a03 user: js tags: trunk | |
12:15 | Implement conditions for win32. check-in: b5e6a49dca user: js tags: trunk | |
Changes
Modified src/OFArray.m from [5597d30fef] to [bcf0037752].
︙ | ︙ | |||
440 441 442 443 444 445 446 447 448 449 450 | initWithDataArray: array mutationsPointer: NULL] autorelease]; } #ifdef OF_HAVE_BLOCKS - (void)enumerateObjectsUsingBlock: (of_array_enumeration_block_t)block { id *objs = [array cArray]; size_t i, count = [array count]; BOOL stop = NO; | > | > > > > > | | > > > > > > > | > > > > > | 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 | initWithDataArray: array mutationsPointer: NULL] autorelease]; } #ifdef OF_HAVE_BLOCKS - (void)enumerateObjectsUsingBlock: (of_array_enumeration_block_t)block { OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; id *objs = [array cArray]; size_t i, count = [array count]; BOOL stop = NO; for (i = 0; i < count && !stop; i++) { block(objs[i], i, &stop); [pool releaseObjects]; } [pool release]; } - (OFArray*)mappedArrayUsingBlock: (of_array_map_block_t)block { OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; OFArray *ret; size_t count = [array count]; id *tmp = [self allocMemoryForNItems: count withSize: sizeof(id)]; @try { id *objs = [array cArray]; size_t i; for (i = 0; i < count; i++) tmp[i] = block(objs[i], i); ret = [[OFArray alloc] initWithCArray: tmp length: count]; @try { [pool release]; } @finally { [ret autorelease]; } } @finally { [self freeMemory: tmp]; } return ret; } - (OFArray*)filteredArrayUsingBlock: (of_array_filter_block_t)block { OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; OFArray *ret; size_t count = [array count]; id *tmp = [self allocMemoryForNItems: count withSize: sizeof(id)]; @try { id *objs = [array cArray]; size_t i, j = 0; for (i = 0; i < count; i++) { if (block(objs[i], i)) tmp[j++] = objs[i]; [pool releaseObjects]; } [pool release]; ret = [OFArray arrayWithCArray: tmp length: j]; } @finally { [self freeMemory: tmp]; } |
︙ | ︙ |
Modified src/OFDictionary.m from [fc36854d4b] to [5163795b89].
︙ | ︙ | |||
598 599 600 601 602 603 604 605 606 607 | mutationsPointer: NULL] autorelease]; } #ifdef OF_HAVE_BLOCKS - (void)enumerateKeysAndObjectsUsingBlock: (of_dictionary_enumeration_block_t)block { size_t i; BOOL stop = NO; | > | | > > > > > | 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 | mutationsPointer: NULL] autorelease]; } #ifdef OF_HAVE_BLOCKS - (void)enumerateKeysAndObjectsUsingBlock: (of_dictionary_enumeration_block_t)block { OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; size_t i; BOOL stop = NO; for (i = 0; i < size && !stop; i++) { if (data[i] != NULL && data[i] != DELETED) { block(data[i]->key, data[i]->object, &stop); [pool releaseObjects]; } } [pool release]; } - (OFDictionary*)mappedDictionaryUsingBlock: (of_dictionary_map_block_t)block { OFMutableDictionary *dict = [OFMutableDictionary dictionary]; size_t i; |
︙ | ︙ |
Modified src/OFMutableArray.m from [7063d7690d] to [bb6cf54c6a].
︙ | ︙ | |||
16 17 18 19 20 21 22 23 24 25 26 27 28 29 | #include "config.h" #include <string.h> #import "OFMutableArray.h" #import "OFDataArray.h" #import "OFExceptions.h" @implementation OFMutableArray - copy { OFArray *new = [[OFArray alloc] init]; id *objs; | > | 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | #include "config.h" #include <string.h> #import "OFMutableArray.h" #import "OFDataArray.h" #import "OFAutoreleasePool.h" #import "OFExceptions.h" @implementation OFMutableArray - copy { OFArray *new = [[OFArray alloc] init]; id *objs; |
︙ | ︙ | |||
222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 | initWithDataArray: array mutationsPointer: &mutations] autorelease]; } #ifdef OF_HAVE_BLOCKS - (void)enumerateObjectsUsingBlock: (of_array_enumeration_block_t)block { id *objs = [array cArray]; size_t i, count = [array count]; BOOL stop = NO; unsigned long mutations2 = mutations; for (i = 0; i < count && !stop; i++) { if (mutations != mutations2) @throw [OFEnumerationMutationException newWithClass: isa]; block(objs[i], i, &stop); } } - (void)replaceObjectsUsingBlock: (of_array_replace_block_t)block { id *objs = [array cArray]; size_t i, count = [array count]; BOOL stop = NO; unsigned long mutations2 = mutations; for (i = 0; i < count && !stop; i++) { if (mutations != mutations2) @throw [OFEnumerationMutationException newWithClass: isa]; id new = block(objs[i], i, &stop); if (new == nil) @throw [OFInvalidArgumentException newWithClass: isa selector: _cmd]; [new retain]; [objs[i] release]; objs[i] = new; | > > > > > | > > > > | 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 | initWithDataArray: array mutationsPointer: &mutations] autorelease]; } #ifdef OF_HAVE_BLOCKS - (void)enumerateObjectsUsingBlock: (of_array_enumeration_block_t)block { OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; id *objs = [array cArray]; size_t i, count = [array count]; BOOL stop = NO; unsigned long mutations2 = mutations; for (i = 0; i < count && !stop; i++) { if (mutations != mutations2) @throw [OFEnumerationMutationException newWithClass: isa]; block(objs[i], i, &stop); [pool releaseObjects]; } [pool release]; } - (void)replaceObjectsUsingBlock: (of_array_replace_block_t)block { OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; id *objs = [array cArray]; size_t i, count = [array count]; BOOL stop = NO; unsigned long mutations2 = mutations; for (i = 0; i < count && !stop; i++) { if (mutations != mutations2) @throw [OFEnumerationMutationException newWithClass: isa]; id new = block(objs[i], i, &stop); if (new == nil) @throw [OFInvalidArgumentException newWithClass: isa selector: _cmd]; [new retain]; [objs[i] release]; objs[i] = new; [pool releaseObjects]; } [pool release]; } #endif @end |
Modified src/OFMutableDictionary.m from [16f741d077] to [5577794406].
︙ | ︙ | |||
15 16 17 18 19 20 21 22 23 24 25 26 27 28 | */ #include "config.h" #include <string.h> #import "OFMutableDictionary.h" #import "OFExceptions.h" #import "macros.h" #define BUCKET struct of_dictionary_bucket #define DELETED &of_dictionary_deleted_bucket @implementation OFMutableDictionary | > | 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | */ #include "config.h" #include <string.h> #import "OFMutableDictionary.h" #import "OFAutoreleasePool.h" #import "OFExceptions.h" #import "macros.h" #define BUCKET struct of_dictionary_bucket #define DELETED &of_dictionary_deleted_bucket @implementation OFMutableDictionary |
︙ | ︙ | |||
271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 | mutationsPointer: &mutations] autorelease]; } #ifdef OF_HAVE_BLOCKS - (void)enumerateKeysAndObjectsUsingBlock: (of_dictionary_enumeration_block_t)block { size_t i; BOOL stop = NO; unsigned long mutations2 = mutations; for (i = 0; i < size && !stop; i++) { if (mutations != mutations2) @throw [OFEnumerationMutationException newWithClass: isa]; | > | > | > > > > | > | > > > | 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 | mutationsPointer: &mutations] autorelease]; } #ifdef OF_HAVE_BLOCKS - (void)enumerateKeysAndObjectsUsingBlock: (of_dictionary_enumeration_block_t)block { OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; size_t i; BOOL stop = NO; unsigned long mutations2 = mutations; for (i = 0; i < size && !stop; i++) { if (mutations != mutations2) @throw [OFEnumerationMutationException newWithClass: isa]; if (data[i] != NULL && data[i] != DELETED) { block(data[i]->key, data[i]->object, &stop); [pool releaseObjects]; } } [pool release]; } - (void)replaceObjectsUsingBlock: (of_dictionary_replace_block_t)block { OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; size_t i; BOOL stop = NO; unsigned long mutations2 = mutations; for (i = 0; i < size && !stop; i++) { if (mutations != mutations2) @throw [OFEnumerationMutationException newWithClass: isa]; if (data[i] != NULL && data[i] != DELETED) { id new = block(data[i]->key, data[i]->object, &stop); if (new == nil) @throw [OFInvalidArgumentException newWithClass: isa selector: _cmd]; [new retain]; [data[i]->object release]; data[i]->object = new; [pool releaseObjects]; } } [pool release]; } #endif @end |