forked from enlightenment/efl
eina: improve EINA_VALUE_ARRAY_FOREACH to not systematically require &.
This commit is contained in:
parent
5b4d64ac13
commit
5bfdc435c7
|
@ -1828,6 +1828,7 @@ static inline Eina_Bool eina_value_array_value_get(const Eina_Value *src,
|
|||
/**
|
||||
* @def EINA_VALUE_ARRAY_FOREACH
|
||||
* @brief Definition for the macro to iterate over an array contained in an Eina_Value.
|
||||
* @since 1.21
|
||||
*
|
||||
* @param array The list to iterate over.
|
||||
* @param length Contain the length of the array
|
||||
|
@ -1843,21 +1844,16 @@ static inline Eina_Bool eina_value_array_value_get(const Eina_Value *src,
|
|||
* Eina_Value array;
|
||||
* Eina_Error err;
|
||||
* unsigned int i, len;
|
||||
* Eina_Value v = EINA_VALUE_EMPTY;
|
||||
*
|
||||
* // array is already filled,
|
||||
* // array is already filled with EINA_VALUE_TYPE_ERROR,
|
||||
* // its elements are unknown,
|
||||
* // EINA_VALUE_ARRAY_FOREACH will be used to check if there is no error
|
||||
*
|
||||
*
|
||||
* EINA_VALUE_ARRAY_FOREACH(&array, len, i, &v)
|
||||
* EINA_VALUE_ARRAY_FOREACH(&array, len, i, err)
|
||||
* {
|
||||
* if (v.type == EINA_VALUE_TYPE_ERROR)
|
||||
* {
|
||||
* eina_value_get(&v, &err);
|
||||
* fprintf(stderr, "Something has gone wrong: %s at index: %i\n", eina_error_msg_get(err), i);
|
||||
* abort();
|
||||
* }
|
||||
* eina_value_get(&v, &err);
|
||||
* fprintf(stderr, "Something has gone wrong: %s at index: %i\n", eina_error_msg_get(err), i);
|
||||
* }
|
||||
* @endcode
|
||||
*
|
||||
|
@ -1866,10 +1862,10 @@ static inline Eina_Bool eina_value_array_value_get(const Eina_Value *src,
|
|||
#define EINA_VALUE_ARRAY_FOREACH(Array, Length, It, Value) \
|
||||
for (Length = eina_value_array_count(Array), \
|
||||
It = 0, \
|
||||
eina_value_array_get(Array, It, Value); \
|
||||
eina_value_array_get(Array, It, &Value); \
|
||||
It < Length; \
|
||||
It++, \
|
||||
eina_value_array_get(Array, It, Value))
|
||||
eina_value_array_get(Array, It, &Value))
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
|
Loading…
Reference in New Issue