ObjFW  Diff

Differences From Artifact [c2a9160a23]:

To Artifact [7a4da4f986]:


406
407
408
409
410
411
412

413
414
415
416
417
418
419
420
421
422
423
424
425


426
427
428


429
430
431
432

433
434
435
436
437
438
439
440
441
442
443
444
445
446


447
448
449


450
451
452
453
454
455
456
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424


425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448


449
450
451
452
453
454
455
456
457
458
459
460
461
462







+











-
-
+
+



+
+




+












-
-
+
+



+
+








	for (i = 0; i < count && !stop; i++)
		block(objs[i], i, &stop);
}

- (OFArray*)mappedArrayUsingBlock: (of_array_map_block_t)block
{
	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);

		return [OFArray arrayWithCArray: tmp
					 length: count];
		ret = [OFArray arrayWithCArray: tmp
					length: count];
	} @finally {
		[self freeMemory: tmp];
	}

	return ret;
}

- (OFArray*)filteredArrayUsingBlock: (of_array_filter_block_t)block
{
	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];

		return [OFArray arrayWithCArray: tmp
					 length: j];
		ret = [OFArray arrayWithCArray: tmp
					length: j];
	} @finally {
		[self freeMemory: tmp];
	}

	return ret;
}
#endif

- (void)dealloc
{
	id *objs = [array cArray];
	size_t i, count = [array count];