From: cedric Date: Mon, 29 Nov 2010 18:32:30 +0000 (+0000) Subject: * eina: eina_array_clean should be inlined from the beginning. X-Git-Tag: submit/2.0alpha-wayland/20121127.222009~890 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7f72173f4ffb7f8cbd96da143bf6922d714b57ec;p=profile%2Fivi%2Feina.git * eina: eina_array_clean should be inlined from the beginning. NOTE: to prevent ABI break, I added the old symbol in eina_abi.c. So binary/library using eina_array_clean should continue to work without any problem. git-svn-id: http://svn.enlightenment.org/svn/e/trunk/eina@55068 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- diff --git a/src/include/eina_array.h b/src/include/eina_array.h index 66a1bbe..e8ca73f 100644 --- a/src/include/eina_array.h +++ b/src/include/eina_array.h @@ -80,7 +80,7 @@ EAPI void eina_array_free(Eina_Array *array) EINA_ARG_NONNULL(1); EAPI void eina_array_step_set(Eina_Array *array, unsigned int sizeof_eina_array, unsigned int step) EINA_ARG_NONNULL(1); -EAPI void eina_array_clean(Eina_Array *array) EINA_ARG_NONNULL(1); +static inline void eina_array_clean(Eina_Array *array) EINA_ARG_NONNULL(1); EAPI void eina_array_flush(Eina_Array *array) EINA_ARG_NONNULL(1); EAPI Eina_Bool eina_array_remove(Eina_Array * array, Eina_Bool (*keep)(void *data, void *gdata), diff --git a/src/include/eina_inline_array.x b/src/include/eina_inline_array.x index 883d728..5216462 100644 --- a/src/include/eina_inline_array.x +++ b/src/include/eina_inline_array.x @@ -175,6 +175,21 @@ eina_array_foreach(Eina_Array *array, Eina_Each_Cb cb, void *fdata) } /** + * @brief Clean an array. + * + * @param array The array to clean. + * + * This function sets the count member of @p array to 0. For + * performance reasons, there is no check of @p array. If it is + * @c NULL or invalid, the program may crash. + */ +static inline void +eina_array_clean(Eina_Array *array) +{ + array->count = 0; +} + +/** * @} */ diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am index fac41ad..d444dd4 100644 --- a/src/lib/Makefile.am +++ b/src/lib/Makefile.am @@ -45,7 +45,8 @@ eina_tiler.c \ eina_unicode.c \ eina_ustrbuf.c \ eina_ustringshare.c \ -eina_value.c +eina_value.c \ +eina_abi.c if EINA_HAVE_WIN32 base_sources += eina_file_win32.c diff --git a/src/lib/eina_abi.c b/src/lib/eina_abi.c new file mode 100644 index 0000000..0155a99 --- /dev/null +++ b/src/lib/eina_abi.c @@ -0,0 +1,59 @@ +/* EINA - EFL data type library + * Copyright (C) 2010 Cedric Bail + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; + * if not, see . + */ + +/* This file is here to preserve ABI compatibility, don't touch + it unless you know what you are doing */ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include +#include +#include +#include + +#include "eina_config.h" +#include "eina_private.h" +#include "eina_error.h" +#include "eina_log.h" +#include "eina_safety_checks.h" + +typedef struct _Eina_Array Eina_Array; +struct _Eina_Array +{ +#define EINA_ARRAY_VERSION 1 + int version; + + void **data; + unsigned int total; + unsigned int count; + unsigned int step; + EINA_MAGIC +}; + +EAPI void +eina_array_clean(Eina_Array *array) +{ + EINA_SAFETY_ON_NULL_RETURN(array); + + assert(array->version == EINA_ARRAY_VERSION); + + array->count = 0; +} + diff --git a/src/lib/eina_array.c b/src/lib/eina_array.c index bd71fc9..3bf6d73 100644 --- a/src/lib/eina_array.c +++ b/src/lib/eina_array.c @@ -484,24 +484,6 @@ eina_array_step_set(Eina_Array *array, } /** - * @brief Clean an array. - * - * @param array The array to clean. - * - * This function sets the count member of @p array to 0. For - * performance reasons, there is no check of @p array. If it is - * @c NULL or invalid, the program may crash. - */ -EAPI void -eina_array_clean(Eina_Array *array) -{ - EINA_SAFETY_ON_NULL_RETURN(array); - EINA_MAGIC_CHECK_ARRAY(array); - - array->count = 0; -} - -/** * @brief Flush an array. * * @param array The array to flush.