]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/basic/mempool.h
Turn VALGRIND variable into a meson configuration switch
[thirdparty/systemd.git] / src / basic / mempool.h
CommitLineData
53e1b683 1/* SPDX-License-Identifier: LGPL-2.1+ */
b3dcf58e
MS
2#pragma once
3
4/***
5 This file is part of systemd.
6
7 Copyright 2011-2014 Lennart Poettering
8 Copyright 2014 Michal Schmidt
b3dcf58e
MS
9***/
10
11#include <stddef.h>
12
13struct pool;
14
15struct mempool {
16 struct pool *first_pool;
17 void *freelist;
18 size_t tile_size;
19 unsigned at_least;
20};
21
22void* mempool_alloc_tile(struct mempool *mp);
52fc5ce3 23void* mempool_alloc0_tile(struct mempool *mp);
b3dcf58e
MS
24void mempool_free_tile(struct mempool *mp, void *p);
25
26#define DEFINE_MEMPOOL(pool_name, tile_type, alloc_at_least) \
dd422d1e 27static struct mempool pool_name = { \
b3dcf58e
MS
28 .tile_size = sizeof(tile_type), \
29 .at_least = alloc_at_least, \
30}
31
32
d18cb393 33#if VALGRIND
b3dcf58e
MS
34void mempool_drop(struct mempool *mp);
35#endif