chiark / gitweb /
tree-wide: drop copyright headers from frequent contributors
[elogind.git] / src / basic / mempool.h
1 /* SPDX-License-Identifier: LGPL-2.1+ */
2 #pragma once
3
4
5 #include <stddef.h>
6
7 struct pool;
8
9 struct mempool {
10         struct pool *first_pool;
11         void *freelist;
12         size_t tile_size;
13         unsigned at_least;
14 };
15
16 void* mempool_alloc_tile(struct mempool *mp);
17 void* mempool_alloc0_tile(struct mempool *mp);
18 void mempool_free_tile(struct mempool *mp, void *p);
19
20 #define DEFINE_MEMPOOL(pool_name, tile_type, alloc_at_least) \
21 static struct mempool pool_name = { \
22         .tile_size = sizeof(tile_type), \
23         .at_least = alloc_at_least, \
24 }
25
26 #if VALGRIND
27 void mempool_drop(struct mempool *mp);
28 #endif