From ea8ed3e250a0bde3bb3b4ebe7dcfce468bb03d6c Mon Sep 17 00:00:00 2001 From: cedric Date: Wed, 5 Nov 2008 17:16:07 +0000 Subject: [PATCH] Add eina_array_data_set. git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/eina@37475 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- src/include/eina_array.h | 1 + src/include/eina_inline_array.x | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/src/include/eina_array.h b/src/include/eina_array.h index d8fe739..1e9ed8c 100644 --- a/src/include/eina_array.h +++ b/src/include/eina_array.h @@ -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); diff --git a/src/include/eina_inline_array.x b/src/include/eina_inline_array.x index eaf193f..20aee34 100644 --- a/src/include/eina_inline_array.x +++ b/src/include/eina_inline_array.x @@ -102,6 +102,23 @@ eina_array_data_get(const Eina_Array *array, unsigned int 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. * * @param array The array. -- 2.7.4