Re-import of fprobe-ulog
[fprobe-ulog.git] / trunk / src / mem.h
1 /*
2         Copyright (C) Slava Astashonok <sla@0n.ru>
3
4         This program is free software; you can redistribute it and/or
5         modify it under the terms of the GNU General Public License.
6
7         $Id: mem.h,v 1.1.1.1.2.3 2004/08/13 20:40:43 sla Exp $
8 */
9
10 #ifndef _MEM_H_
11 #define _MEM_H_
12
13 #if MEM_BITS != 0 && MEM_BITS != 8 && MEM_BITS != 16
14 #error illegal value in MEM_BITS
15 #endif
16
17 #if defined _REENTRANT || defined _THREAD_SAFE
18 #define MEM_THREADSAFE
19 #endif
20
21 #include <my_inttypes.h>
22
23 #if MEM_BITS == 0
24 typedef void* mem_index_t;
25 #endif
26 #if MEM_BITS == 8
27 typedef uint8_t mem_index_t;
28 #endif
29 #if MEM_BITS == 16
30 typedef uint16_t mem_index_t;
31 #endif
32
33 void *mem_alloc();
34 void mem_free(void *);
35 int mem_init(unsigned int, unsigned int, unsigned int);
36
37 struct Mem {
38         struct Mem *next;
39         unsigned int free;
40         void *first;
41         void *last;
42         /*
43         mem_index_t mem_index_table[bulk_quantity]
44         struct UserDef element_table[bulk_quantity]
45         */
46 };
47
48 #endif