return array->len - 1;
}
+EAPI void *
+eina_inarray_add(Eina_Inarray *array)
+{
+ void *p;
+
+ EINA_MAGIC_CHECK_INARRAY(array, NULL);
+
+ if (!_eina_inarray_resize(array, array->len + 1))
+ return NULL;
+
+ p = _eina_inarray_get(array, array->len);
+ array->len++;
+
+ return p;
+}
+
EAPI int
eina_inarray_insert(Eina_Inarray *array, const void *data, Eina_Compare_Cb compare)
{
if (!_eina_inarray_resize(array, array->len - 1))
return NULL;
array->len--;
- return _eina_inarray_get(array, array->len + 1);
+ return _eina_inarray_get(array, array->len);
}
EAPI void *
EAPI int eina_inarray_push(Eina_Inarray *array,
const void *data) EINA_ARG_NONNULL(1, 2);
+/**
+ * @brief Allocate a new item at the end of the array.
+ * @param array array object
+ *
+ * The returned pointer is only valid until you use any other eina_inarray
+ * function.
+ *
+ * @since 1.8
+ */
+EAPI void *eina_inarray_add(Eina_Inarray *array);
+
/**
* @brief Copy the data to array at position found by comparison function
* @param array array object