mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 00:11:04 +00:00
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@29172 72102866-910b-0410-8b05-ffd578937521
38 lines
1.1 KiB
C
38 lines
1.1 KiB
C
|
|
#ifdef __clang__
|
|
#define FOR_IN(type, var, collection) \
|
|
for (type var in collection)\
|
|
{
|
|
#define END_FOR_IN(collection) }
|
|
#else
|
|
void objc_enumerationMutation(id);
|
|
#define FOR_IN(type, var, c) \
|
|
do\
|
|
{\
|
|
type var;\
|
|
NSFastEnumerationState gs_##c##_enumState = { 0 };\
|
|
id gs_##c##_items[16];\
|
|
unsigned long gs_##c##_limit = \
|
|
[c countByEnumeratingWithState: &gs_##c##_enumState \
|
|
objects: gs_##c##_items \
|
|
count: 16];\
|
|
if (gs_##c##_limit)\
|
|
{\
|
|
unsigned long gs_startMutations = *gs_##c##_enumState.mutationsPtr;\
|
|
do {\
|
|
unsigned long gs_##c##counter = 0;\
|
|
do {\
|
|
if (gs_startMutations != *gs_##c##_enumState.mutationsPtr)\
|
|
{\
|
|
objc_enumerationMutation(c);\
|
|
}\
|
|
var = gs_##c##_enumState.itemsPtr[gs_##c##counter++];\
|
|
|
|
#define END_FOR_IN(c) \
|
|
} while (gs_##c##counter < gs_##c##_limit);\
|
|
} while ((gs_##c##_limit = [c countByEnumeratingWithState: &gs_##c##_enumState\
|
|
objects: gs_##c##_items\
|
|
count: 16]));\
|
|
}\
|
|
} while(0);
|
|
#endif
|