eina: add eina_inarray_resize @feature.
authorFelipe Magno de Almeida <felipe@expertisesolutions.com.br>
Tue, 25 Feb 2014 20:19:11 +0000 (17:19 -0300)
committerCedric Bail <cedric.bail@free.fr>
Tue, 25 Feb 2014 20:33:36 +0000 (17:33 -0300)
Signed-off-by: Cedric Bail <cedric.bail@free.fr>
src/lib/eina/eina_inarray.c
src/lib/eina/eina_inarray.h

index e674a20f3c2e6dd41abc9493e6847fb69909a92a..c1e07bed6d1803ba4ba5686de76424c215f2cb30 100644 (file)
@@ -382,6 +382,19 @@ eina_inarray_flush(Eina_Inarray *array)
    array->members = NULL;
 }
 
+EAPI Eina_Bool
+eina_inarray_resize(Eina_Inarray *array, unsigned int new_size)
+{
+   Eina_Bool r;
+   EINA_MAGIC_CHECK_INARRAY(array, EINA_FALSE);
+
+   r = _eina_inarray_resize(array, new_size);
+   if(!r) return EINA_FALSE;
+
+   array->len = new_size;
+   return EINA_TRUE;
+}
+
 EAPI int
 eina_inarray_push(Eina_Inarray *array, const void *data)
 {
index 9d7f9f6d8c558d21779b8c119b579217ff30b942..b9010d7d4e6d3f35e45b5c5cb7a5679e3f3567b6 100644 (file)
@@ -601,6 +601,16 @@ EAPI int eina_inarray_foreach_remove(Eina_Inarray *array,
                                      Eina_Each_Cb match,
                                      const void *user_data) EINA_ARG_NONNULL(1, 2);
 
+/**
+ * @brief Resize array to new size
+ * @param array array object
+ * @param new_size
+ * @return #EINA_TRUE if it successfully resized the array
+ *
+ * @since 1.10
+ */
+EAPI Eina_Bool eina_inarray_resize(Eina_Inarray *array, unsigned int new_size);
+
 /**
  * @brief number of members in array.
  * @param array array object