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