ObjFW  Check-in [fd7e4116e3]

Overview
Comment:Revert to old of_fast_enumeration_state_t as gcc 4.6 chokes on the new.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: fd7e4116e3c74f03345835b71bd1626c8c4d5f6cab177656156a15f11c2c52d8
User & Date: js on 2011-07-23 15:02:22
Other Links: manifest | tags
Context
2011-07-23
15:40
Add properties to OFString. check-in: 3eae5ffa15 user: js tags: trunk
15:02
Revert to old of_fast_enumeration_state_t as gcc 4.6 chokes on the new. check-in: fd7e4116e3 user: js tags: trunk
14:28
Add OFIntrospection. check-in: 2e7534b6dc user: js tags: trunk
Changes

Modified src/OFEnumerator.h from [bd16795e9a] to [992da1f406].

64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
	/// Arbitrary state information for the enumeration
	unsigned long state;
	/// Pointer to a C array of objects to return
	id *itemsPtr;
	/// Arbitrary state information to detect mutations
	unsigned long *mutationsPtr;
	/// Additional arbitrary state information
	union {
		unsigned long longs[5];
		void *pointers[2];
	} extra;
} of_fast_enumeration_state_t;
#endif

/**
 * \brief A protocol for fast enumeration.
 *
 * The OFFastEnumeration protocol needs to be implemented by all classes







<
|
<
<







64
65
66
67
68
69
70

71


72
73
74
75
76
77
78
	/// Arbitrary state information for the enumeration
	unsigned long state;
	/// Pointer to a C array of objects to return
	id *itemsPtr;
	/// Arbitrary state information to detect mutations
	unsigned long *mutationsPtr;
	/// Additional arbitrary state information

	unsigned long extra[5];


} of_fast_enumeration_state_t;
#endif

/**
 * \brief A protocol for fast enumeration.
 *
 * The OFFastEnumeration protocol needs to be implemented by all classes

Modified src/OFList.m from [e971f4ddef] to [58ae77a2af].

390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
	return element;
}

- (int)countByEnumeratingWithState: (of_fast_enumeration_state_t*)state
			   objects: (id*)objects
			     count: (int)count_
{
	of_list_object_t *listObject = state->extra.pointers[0];
	int i;

	state->itemsPtr = objects;
	state->mutationsPtr = &mutations;

	if (state->state == 0) {
		listObject = firstListObject;
		state->state = 1;
	}

	for (i = 0; i < count_; i++) {
		if (listObject == NULL) {
			state->extra.pointers[0] = NULL;
			return i;
		}

		objects[i] = listObject->object;
		listObject = listObject->next;
	}

	state->extra.pointers[0] = listObject;

	return count_;
}

- (OFEnumerator*)objectEnumerator
{
	return [[[OFListEnumerator alloc]
		initWithList: self







|






|




|
<

|
<
|
|


<
<







390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409

410
411

412
413
414
415


416
417
418
419
420
421
422
	return element;
}

- (int)countByEnumeratingWithState: (of_fast_enumeration_state_t*)state
			   objects: (id*)objects
			     count: (int)count_
{
	of_list_object_t **listObject = (of_list_object_t**)&state->extra[0];
	int i;

	state->itemsPtr = objects;
	state->mutationsPtr = &mutations;

	if (state->state == 0) {
		*listObject = firstListObject;
		state->state = 1;
	}

	for (i = 0; i < count_; i++) {
		if (*listObject == NULL)

			return i;


		objects[i] = (*listObject)->object;
		*listObject = (*listObject)->next;
	}



	return count_;
}

- (OFEnumerator*)objectEnumerator
{
	return [[[OFListEnumerator alloc]
		initWithList: self