forked from enlightenment/efl
Add eina_array_count(), deprecate eina_array_count_get().
This makes the API more uniform. SVN revision: 67001
This commit is contained in:
parent
655e20307a
commit
398bf0ee45
|
@ -351,7 +351,8 @@ static inline void *eina_array_data_get(const Eina_Array *array,
|
|||
static inline void eina_array_data_set(const Eina_Array *array,
|
||||
unsigned int idx,
|
||||
const void *data) EINA_ARG_NONNULL(1);
|
||||
static inline unsigned int eina_array_count_get(const Eina_Array *array) EINA_ARG_NONNULL(1);
|
||||
static inline unsigned int eina_array_count_get(const Eina_Array *array) EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT EINA_DEPRECATED;
|
||||
static inline unsigned int eina_array_count(const Eina_Array *array) EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT;
|
||||
|
||||
/**
|
||||
* @brief Returned a new iterator associated to an array.
|
||||
|
@ -429,7 +430,7 @@ static inline Eina_Bool eina_array_foreach(Eina_Array *array,
|
|||
*/
|
||||
#define EINA_ARRAY_ITER_NEXT(array, index, item, iterator) \
|
||||
for (index = 0, iterator = (array)->data; \
|
||||
(index < eina_array_count_get(array)) && ((item = *((iterator)++))); \
|
||||
(index < eina_array_count(array)) && ((item = *((iterator)++))); \
|
||||
++(index))
|
||||
|
||||
#include "eina_inline_array.x"
|
||||
|
|
|
@ -128,6 +128,8 @@ eina_array_data_set(const Eina_Array *array, unsigned int idx, const void *data)
|
|||
* This function returns the number of elements in @p array. For
|
||||
* performance reasons, there is no check of @p array. If it is
|
||||
* @c NULL or invalid, the program may crash.
|
||||
*
|
||||
* @deprecated use eina_array_count()
|
||||
*/
|
||||
static inline unsigned int
|
||||
eina_array_count_get(const Eina_Array *array)
|
||||
|
@ -135,6 +137,22 @@ eina_array_count_get(const Eina_Array *array)
|
|||
return array->count;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Return the number of elements in an array.
|
||||
*
|
||||
* @param array The array.
|
||||
* @return The number of elements.
|
||||
*
|
||||
* This function returns the number of elements in @p array. For
|
||||
* performance reasons, there is no check of @p array. If it is
|
||||
* @c NULL or invalid, the program may crash.
|
||||
*/
|
||||
static inline unsigned int
|
||||
eina_array_count(const Eina_Array *array)
|
||||
{
|
||||
return array->count;
|
||||
}
|
||||
|
||||
static inline Eina_Bool
|
||||
eina_array_foreach(Eina_Array *array, Eina_Each_Cb cb, void *fdata)
|
||||
{
|
||||
|
|
|
@ -119,7 +119,7 @@ eina_array_iterator_next(Eina_Iterator_Array *it, void **data)
|
|||
{
|
||||
EINA_MAGIC_CHECK_ARRAY_ITERATOR(it, EINA_FALSE);
|
||||
|
||||
if (!(it->index < eina_array_count_get(it->array)))
|
||||
if (!(it->index < eina_array_count(it->array)))
|
||||
return EINA_FALSE;
|
||||
|
||||
if (data)
|
||||
|
@ -150,7 +150,7 @@ eina_array_accessor_get_at(Eina_Accessor_Array *it,
|
|||
{
|
||||
EINA_MAGIC_CHECK_ARRAY_ACCESSOR(it, EINA_FALSE);
|
||||
|
||||
if (!(idx < eina_array_count_get(it->array)))
|
||||
if (!(idx < eina_array_count(it->array)))
|
||||
return EINA_FALSE;
|
||||
|
||||
if (data)
|
||||
|
|
Loading…
Reference in New Issue