aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFelipe Magno de Almeida <felipe@expertisesolutions.com.br>2017-07-19 17:22:47 -0300
committerLarry Jr <larry.olj@gmail.com>2017-07-27 17:31:47 -0300
commitb07e62cdfd5ed1d0b71da9941d350f5f726de3ae (patch)
treea53e096518d908c35e9f41a5f58ed28f11d81a71
parentefl: Modify documentation in efl model so slice is 0-based, not 1-based (diff)
downloadefl-b07e62cdfd5ed1d0b71da9941d350f5f726de3ae.tar.gz
eina: Add eina_inarray_setup for in-place construction of Eina_Inarray
-rw-r--r--src/lib/eina/eina_inarray.c8
-rw-r--r--src/lib/eina/eina_inarray.h20
2 files changed, 24 insertions, 4 deletions
diff --git a/src/lib/eina/eina_inarray.c b/src/lib/eina/eina_inarray.c
index a216f0291b..3263eab760 100644
--- a/src/lib/eina/eina_inarray.c
+++ b/src/lib/eina/eina_inarray.c
@@ -106,8 +106,8 @@ static int _eina_inarray_log_dom = -1;
} \
while(0)
-static void
-_eina_inarray_setup(Eina_Inarray *array, unsigned int member_size, unsigned int step)
+void
+eina_inarray_setup(Eina_Inarray *array, unsigned int member_size, unsigned int step)
{
EINA_MAGIC_SET(array, EINA_MAGIC_INARRAY);
array->version = EINA_ARRAY_VERSION;
@@ -346,7 +346,7 @@ eina_inarray_new(unsigned int member_size, unsigned int step)
ret = malloc(sizeof(*ret));
if (!ret) return NULL;
- _eina_inarray_setup(ret, member_size, step);
+ eina_inarray_setup(ret, member_size, step);
return ret;
}
@@ -380,7 +380,7 @@ eina_inarray_step_set(Eina_Inarray *array,
return;
}
- _eina_inarray_setup(array, member_size, step);
+ eina_inarray_setup(array, member_size, step);
}
EAPI void
diff --git a/src/lib/eina/eina_inarray.h b/src/lib/eina/eina_inarray.h
index 7bba977a5b..a377b94abd 100644
--- a/src/lib/eina/eina_inarray.h
+++ b/src/lib/eina/eina_inarray.h
@@ -235,6 +235,26 @@ struct _Eina_Inarray
};
/**
+ * @brief Initializes a inline array in-place.
+ * @details This initializes an array where members are inlined in a sequence. Each
+ * member has @a member_size bytes.
+ *
+ * @param[in] array Pointer to uninitialized array
+ * @param[in] member_size The size of each member in the array
+ * @param[in] step The step size by which to resize the array, do this using the following
+ * extra amount
+ * @return The new inline array table, otherwise @c NULL on failure
+ *
+ * @note If the @a step is @c 0, then a safe default is chosen.
+ *
+ * @see eina_inarray_free()
+ *
+ * @since 1.2
+ */
+EAPI void eina_inarray_setup(Eina_Inarray* array, unsigned int member_size,
+ unsigned int step);
+
+/**
* @brief Creates a new inline array.
* @details This creates a new array where members are inlined in a sequence. Each
* member has @a member_size bytes.