From aaae4e223a5a6ff0fee60578aa27112d85ad0f0f Mon Sep 17 00:00:00 2001 From: Cedric BAIL Date: Mon, 29 Nov 2010 18:32:30 +0000 Subject: [PATCH] * 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. SVN revision: 55068 --- legacy/eina/src/include/eina_array.h | 2 +- legacy/eina/src/include/eina_inline_array.x | 15 ++++++ legacy/eina/src/lib/Makefile.am | 3 +- legacy/eina/src/lib/eina_abi.c | 59 +++++++++++++++++++++ legacy/eina/src/lib/eina_array.c | 18 ------- 5 files changed, 77 insertions(+), 20 deletions(-) create mode 100644 legacy/eina/src/lib/eina_abi.c diff --git a/legacy/eina/src/include/eina_array.h b/legacy/eina/src/include/eina_array.h index 66a1bbe300..e8ca73fa45 100644 --- a/legacy/eina/src/include/eina_array.h +++ b/legacy/eina/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/legacy/eina/src/include/eina_inline_array.x b/legacy/eina/src/include/eina_inline_array.x index 883d728b8d..5216462317 100644 --- a/legacy/eina/src/include/eina_inline_array.x +++ b/legacy/eina/src/include/eina_inline_array.x @@ -174,6 +174,21 @@ eina_array_foreach(Eina_Array *array, Eina_Each_Cb cb, void *fdata) return ret; } +/** + * @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/legacy/eina/src/lib/Makefile.am b/legacy/eina/src/lib/Makefile.am index fac41ad198..d444dd46b6 100644 --- a/legacy/eina/src/lib/Makefile.am +++ b/legacy/eina/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/legacy/eina/src/lib/eina_abi.c b/legacy/eina/src/lib/eina_abi.c new file mode 100644 index 0000000000..0155a99df7 --- /dev/null +++ b/legacy/eina/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/legacy/eina/src/lib/eina_array.c b/legacy/eina/src/lib/eina_array.c index bd71fc9782..3bf6d73a92 100644 --- a/legacy/eina/src/lib/eina_array.c +++ b/legacy/eina/src/lib/eina_array.c @@ -483,24 +483,6 @@ eina_array_step_set(Eina_Array *array, EINA_MAGIC_SET(array, EINA_MAGIC_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. *