Add eina_array_data_set.

SVN revision: 37475
This commit is contained in:
Cedric BAIL 2008-11-05 17:16:07 +00:00
parent e63dde947d
commit e8ed3963c8
2 changed files with 18 additions and 0 deletions

View File

@ -86,6 +86,7 @@ EAPI Eina_Bool eina_array_remove (Eina_Array *array, Eina_Bool (*keep)(void
static inline Eina_Bool eina_array_push (Eina_Array *array, const void *data);
static inline void *eina_array_pop (Eina_Array *array);
static inline void *eina_array_data_get (const Eina_Array *array, unsigned int index);
static inline void eina_array_data_set (const Eina_Array *array, unsigned int index, const void *data);
static inline unsigned int eina_array_count_get (const Eina_Array *array);
EAPI Eina_Iterator *eina_array_iterator_new (const Eina_Array *array);

View File

@ -101,6 +101,23 @@ eina_array_data_get(const Eina_Array *array, unsigned int index)
return array->data[index];
}
/**
* @brief Return the data at a given position in an array.
*
* @param array The array.
* @param index The potition of the data to retrieve.
* @return The retrieved data.
*
* This function returns the data at the position @p index in @p
* array. For performance reasons, there is no check of @p array or @p
* index. If it is @c NULL or invalid, the program may crash.
*/
static inline void
eina_array_data_set(const Eina_Array *array, unsigned int index, const void *data)
{
array->data[index] = (void*) data;
}
/**
* @brief Return the number of elements in the array.
*