… | |
… | |
3 | |
3 | |
4 | #include <cstdlib> |
4 | #include <cstdlib> |
5 | |
5 | |
6 | // small blocks allocator |
6 | // small blocks allocator |
7 | |
7 | |
8 | struct rxvt_salloc { |
8 | struct rxvt_salloc |
|
|
9 | { |
9 | struct chain { |
10 | struct chain { |
10 | struct chain *next; |
11 | struct chain *next; |
11 | }; |
12 | }; |
12 | |
13 | |
13 | chain *firstblock; |
14 | chain *firstblock; |
14 | chain *firstline; |
15 | chain *firstline; |
15 | int firstfree; |
16 | unsigned int firstfree; |
16 | int size; |
17 | unsigned int size; |
17 | |
18 | |
18 | rxvt_salloc (int size); |
19 | rxvt_salloc (unsigned int size); |
19 | ~rxvt_salloc (); |
20 | ~rxvt_salloc (); |
20 | |
21 | |
21 | void *alloc (); |
22 | void *alloc (); |
|
|
23 | void *alloc (void *data, unsigned int datalen); |
22 | void free (void *data); |
24 | void free (void *data); |
23 | }; |
25 | }; |
24 | |
26 | |
25 | #endif |
27 | #endif |