ObjFW  Diff

Differences From Artifact [1c467efbfe]:

To Artifact [4bdaba029a]:


348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375

376
377
378
379
380
381
382
383
384
	}
}

- (void)replaceObjectsUsingBlock: (of_array_replace_block_t)block
{
	id *objects = [_array items];
	size_t i, count = [_array count];
	bool stop = false;
	unsigned long mutations = _mutations;

	for (i = 0; i < count && !stop; i++) {
		id newObject;

		if (_mutations != mutations)
			@throw [OFEnumerationMutationException
			    exceptionWithClass: [self class]
					object: self];

		newObject = block(objects[i], i, &stop);

		if (newObject == nil)
			@throw [OFInvalidArgumentException
			    exceptionWithClass: [self class]
				      selector: _cmd];

		[newObject retain];
		[objects[i] release];
		objects[i] = newObject;

	}
}
#endif

- (void)makeImmutable
{
	object_setClass(self, [OFArray_adjacent class]);
}
@end







<


|
|






|

|




|
|
|
>









348
349
350
351
352
353
354

355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
	}
}

- (void)replaceObjectsUsingBlock: (of_array_replace_block_t)block
{
	id *objects = [_array items];
	size_t i, count = [_array count];

	unsigned long mutations = _mutations;

	for (i = 0; i < count; i++) {
		id new;

		if (_mutations != mutations)
			@throw [OFEnumerationMutationException
			    exceptionWithClass: [self class]
					object: self];

		new = block(objects[i], i);

		if (new == nil)
			@throw [OFInvalidArgumentException
			    exceptionWithClass: [self class]
				      selector: _cmd];

		if (new != objects[i]) {
			[objects[i] release];
			objects[i] = [new retain];
		}
	}
}
#endif

- (void)makeImmutable
{
	object_setClass(self, [OFArray_adjacent class]);
}
@end