file: ring_alloc.h
1
/*
2
* Copyright (C) 2008-2009 by Emmanuel Azencot under the GNU LGPL
3
* license version 2.0 or 2.1. You should have received a copy of the
4
* LGPL license along with this library if you did not you can find it
5
* at http://www.gnu.org/.
6
*/
7
/*
8
* Azencot : Sat Dec 6 02:31:40 CET 2008
9
* Creation
10
*/
11
#ifndef _RING_ALLOC_H_ /* [ */
12
#define /*X*/ _RING_ALLOC_H_
13
14
#define /*X*/ RING_ALLOC_VERSION 1
15
#define /*X*/ RING_ALLOC_RELEASE 0
16
17
typedef struct s_mempool * /*X*/ to_mempool;
18
19
to_mempool f_mempool_init(size_t size, void *start);
20
struct /*X*/ s_mempool_info {
21
short version;
22
short release;
23
struct { int stats:1; int chk_pool:1; int chk_blk:1; } options;
24
size_t pool_head_size;
25
size_t block_head_size;
26
};
27
int f_mempool_info(struct s_mempool_info *info);
28
29
struct /*X*/ s_mempool_stats {
30
struct {
31
struct { size_t alloc, free; } blocks, bytes;
32
} instant, cumul;
33
};
34
int f_mempool_stats(to_mempool mempool, struct s_mempool_stats *stats);
35
36
void *f_mempool_malloc(to_mempool mempool, size_t size);
37
38
int f_mempool_free(to_mempool mempool, void *mem);
39
40
void *f_mempool_realloc(to_mempool mempool, void *mem, size_t size);
41
42
void *f_mempool_calloc(to_mempool mempool, size_t nmemb, size_t size);
43
44
#endif /* ] _RING_ALLOC_H_ */
C to HTML Conversion by ctoohtml