* eina: eina_array_clean should be inlined from the beginning.
authorcedric <cedric>
Mon, 29 Nov 2010 18:32:30 +0000 (18:32 +0000)
committercedric <cedric@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Mon, 29 Nov 2010 18:32:30 +0000 (18:32 +0000)
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

src/include/eina_array.h
src/include/eina_inline_array.x
src/lib/Makefile.am
src/lib/eina_abi.c [new file with mode: 0644]
src/lib/eina_array.c

index 66a1bbe..e8ca73f 100644 (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),
index 883d728..5216462 100644 (file)
@@ -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;
+}
+
+/**
  * @}
  */
 
index fac41ad..d444dd4 100644 (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
diff --git a/src/lib/eina_abi.c b/src/lib/eina_abi.c
new file mode 100644 (file)
index 0000000..0155a99
--- /dev/null
@@ -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;
+}
+
index bd71fc9..3bf6d73 100644 (file)
@@ -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.