ObjFW  Diff

Differences From Artifact [5414c26349]:

To Artifact [1bed7cc771]:


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







-
+




-
+

-
+







}

- (id)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: @"@"]) {
872
873
874
875
876
877
878
879

880
881

882
883
884
885
886
887
888
872
873
874
875
876
877
878

879
880

881
882
883
884
885
886
887
888







-
+

-
+







{
	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];
	}
896
897
898
899
900
901
902
903

904
905

906
907
908
909
910
911
912
896
897
898
899
900
901
902

903
904

905
906
907
908
909
910
911
912







-
+

-
+







	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];
921
922
923
924
925
926
927
928

929
930
931
932

933
934
935
936
937
938
939
921
922
923
924
925
926
927

928
929
930
931

932
933
934
935
936
937
938
939







-
+



-
+







	__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 {