ObjFW  Diff

Differences From Artifact [ffbda05782]:

To Artifact [1810203c70]:


259
260
261
262
263
264
265
266

267
268
269
270
271

272
273

274
275
276
277
278
279
280
259
260
261
262
263
264
265

266
267
268
269
270

271
272

273
274
275
276
277
278
279
280







-
+




-
+

-
+







}

- mutableCopy
{
	return [[OFMutableArray alloc] initWithArray: self];
}

- (id)objectAtIndex: (size_t)index
- (id)objectAtIndex: (size_t)idx
{
	OF_UNRECOGNIZED_SELECTOR
}

- (id)objectAtIndexedSubscript: (size_t)index
- (id)objectAtIndexedSubscript: (size_t)idx
{
	return [self objectAtIndex: index];
	return [self objectAtIndex: idx];
}

- (id)valueForKey: (OFString *)key
{
	id ret;

	if ([key hasPrefix: @"@"]) {
855
856
857
858
859
860
861
862

863
864

865
866
867
868
869
870
871
855
856
857
858
859
860
861

862
863

864
865
866
867
868
869
870
871







-
+

-
+







{
	OFArray *ret;
	size_t count = [self count];
	id *tmp = [self allocMemoryWithSize: sizeof(id)
				      count: count];

	@try {
		[self enumerateObjectsUsingBlock: ^ (id object, size_t index,
		[self enumerateObjectsUsingBlock: ^ (id object, size_t idx,
		    bool *stop) {
			tmp[index] = block(object, index);
			tmp[idx] = block(object, idx);
		}];

		ret = [OFArray arrayWithObjects: tmp
					  count: count];
	} @finally {
		[self freeMemory: tmp];
	}
879
880
881
882
883
884
885
886

887
888

889
890
891
892
893
894
895
879
880
881
882
883
884
885

886
887

888
889
890
891
892
893
894
895







-
+

-
+







	size_t count = [self count];
	id *tmp = [self allocMemoryWithSize: sizeof(id)
				      count: count];

	@try {
		__block size_t i = 0;

		[self enumerateObjectsUsingBlock: ^ (id object, size_t index,
		[self enumerateObjectsUsingBlock: ^ (id object, size_t idx,
		    bool *stop) {
			if (block(object, index))
			if (block(object, idx))
				tmp[i++] = object;
		}];

		ret = [OFArray arrayWithObjects: tmp
					  count: i];
	} @finally {
		[self freeMemory: tmp];
904
905
906
907
908
909
910
911

912
913
914
915

916
917
918
919
920
921
922
904
905
906
907
908
909
910

911
912
913
914

915
916
917
918
919
920
921
922







-
+



-
+







	__block id current;

	if (count == 0)
		return nil;
	if (count == 1)
		return [[[self firstObject] retain] autorelease];

	[self enumerateObjectsUsingBlock: ^ (id object, size_t index,
	[self enumerateObjectsUsingBlock: ^ (id object, size_t idx,
	    bool *stop) {
		id new;

		if (index == 0) {
		if (idx == 0) {
			current = [object retain];
			return;
		}

		@try {
			new = [block(current, object) retain];
		} @finally {