Lines Matching defs:pool
22 * The object size and capacity of the pool are fixed at build time. So is the
26 /* Size of 1 object in the pool in byte unit. */
29 /* Number of objects in the pool. */
39 /* Create a static pool of objects. */
48 /* Create a static pool of objects out of an array of pre-allocated objects. */
54 * Allocate 'count' objects from a pool.
57 static inline void *pool_alloc_n(struct object_pool *pool, size_t count)
59 if ((pool->used + count) > pool->capacity) {
60 ERROR("Cannot allocate %zu objects out of pool (%zu objects left).\n",
61 count, pool->capacity - pool->used);
65 void *obj = (char *)(pool->objects) + (pool->obj_size * pool->used);
66 pool->used += count;
71 * Allocate 1 object from a pool.
74 static inline void *pool_alloc(struct object_pool *pool)
76 return pool_alloc_n(pool, 1U);