ObjFW  Check-in [a3b6cca867]

Overview
Comment:OFArray: Add forgotten ivar prefix.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: a3b6cca86737da4cfd2051a14090b49e35dcebc82de9f830e2f698f85b967539
User & Date: js on 2013-08-08 23:21:30
Other Links: manifest | tags
Context
2013-08-10
23:12
Add -[OFMutableDictionary removeAllObjects]. check-in: aae02e7970 user: js tags: trunk
2013-08-08
23:21
OFArray: Add forgotten ivar prefix. check-in: a3b6cca867 user: js tags: trunk
22:09
Update PLATFORMS.md. check-in: 16429fcc2e user: js tags: trunk
Changes

Modified src/OFArray.h from [3b32ab19ad] to [2c8fc0a38f].

391
392
393
394
395
396
397
398
399
400
401
402





403
404
405
406
407
408
409
410
411
412
413
414
391
392
393
394
395
396
397





398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414







-
-
-
-
-
+
+
+
+
+












 */
- (id)foldUsingBlock: (of_array_fold_block_t)block;
#endif
@end

@interface OFArrayEnumerator: OFEnumerator
{
	OFArray	      *array;
	size_t	      count;
	unsigned long mutations;
	unsigned long *mutationsPtr;
	size_t	      position;
	OFArray	      *_array;
	size_t	      _count;
	unsigned long _mutations;
	unsigned long *_mutationsPtr;
	size_t	      _position;
}

- initWithArray: (OFArray*)data
   mutationsPtr: (unsigned long*)mutationsPtr;
@end

#import "OFMutableArray.h"

#ifndef NSINTEGER_DEFINED
/* Required for array literals to work */
@compatibility_alias NSArray OFArray;
#endif

Modified src/OFArray.m from [1b7e4a8b63] to [5e48577b79].

825
826
827
828
829
830
831
832
833


834
835
836
837
838
839
840




841
842
843
844
845
846
847

848
849
850
851
852
853
854

855
856

857
858
859


860
861
862
863
864
865
866

867
868

869
870

871
872
825
826
827
828
829
830
831


832
833
834
835
836




837
838
839
840
841
842
843
844
845
846

847
848
849
850
851
852
853

854
855

856
857


858
859
860
861
862
863
864
865

866
867

868
869

870
871
872







-
-
+
+



-
-
-
-
+
+
+
+






-
+






-
+

-
+

-
-
+
+






-
+

-
+

-
+



	return [current autorelease];
}
#endif
@end

@implementation OFArrayEnumerator
- initWithArray: (OFArray*)array_
   mutationsPtr: (unsigned long*)mutationsPtr_
- initWithArray: (OFArray*)array
   mutationsPtr: (unsigned long*)mutationsPtr
{
	self = [super init];

	array = [array_ retain];
	count = [array count];
	mutations = (mutationsPtr_ != NULL ? *mutationsPtr_ : 0);
	mutationsPtr = mutationsPtr_;
	_array = [array retain];
	_count = [array count];
	_mutations = (mutationsPtr != NULL ? *mutationsPtr : 0);
	_mutationsPtr = mutationsPtr;

	return self;
}

- (void)dealloc
{
	[array release];
	[_array release];

	[super dealloc];
}

- (id)nextObject
{
	if (mutationsPtr != NULL && *mutationsPtr != mutations)
	if (_mutationsPtr != NULL && *_mutationsPtr != _mutations)
		@throw [OFEnumerationMutationException
		    exceptionWithObject: array];
		    exceptionWithObject: _array];

	if (position < count)
		return [array objectAtIndex: position++];
	if (_position < _count)
		return [_array objectAtIndex: _position++];

	return nil;
}

- (void)reset
{
	if (mutationsPtr != NULL && *mutationsPtr != mutations)
	if (_mutationsPtr != NULL && *_mutationsPtr != _mutations)
		@throw [OFEnumerationMutationException
		    exceptionWithObject: array];
		    exceptionWithObject: _array];

	position = 0;
	_position = 0;
}
@end