diff libcore/core/alloc.h @ 237:1bf5bd306bb0

core: add alloc_pool_get function
author David Demelier <markand@malikania.fr>
date Fri, 27 Nov 2020 13:31:27 +0100
parents 2734223d3daf
children
line wrap: on
line diff
--- a/libcore/core/alloc.h	Fri Nov 27 13:31:16 2020 +0100
+++ b/libcore/core/alloc.h	Fri Nov 27 13:31:27 2020 +0100
@@ -235,6 +235,18 @@
 alloc_pool_new(struct alloc_pool *pool);
 
 /**
+ * Get the value at the given index.
+ *
+ * \pre pool != NULL
+ * \pre index < pool->size
+ * \param pool the pool
+ * \param index the object index
+ * \return The pointer to the region.
+ */
+void *
+alloc_pool_get(const struct alloc_pool *pool, size_t index);
+
+/**
  * Finalize the pool and all individual element if a finalizer is set.
  *
  * You must call \ref alloc_pool_init again before reusing it.