* 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
This commit is contained in:
Cedric BAIL 2010-11-29 18:32:30 +00:00
parent 92c16f8892
commit aaae4e223a
5 changed files with 77 additions and 20 deletions

View File

@ -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),

View File

@ -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;
}
/**
* @}
*/

View File

@ -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

View File

@ -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 <http://www.gnu.org/licenses/>.
*/
/* 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 <assert.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#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;
}

View File

@ -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.
*