Debian Codegraph @

libs/pplib/pplib-src/src/ppheap.h

raw
1
2 #ifndef PP_HEAP_H
3 #define PP_HEAP_H
4
5 #include "utilmem.h"
6
7 #define pp_malloc util_malloc
8 //#define pp_callic util_calloc
9 //#define pp_realloc util_realloc
10 #define pp_free util_free
11
12 #include "utilmemheapiof.h"
13 //#include "utilmeminfo.h"
14
15 #define ppbytes_heap heap16
16 #define ppbytes_heap_init(heap, space, large, flags) (heap16_init(&(heap)->bytesheap, space, large, flags), heap16_head(&(heap)->bytesheap))
17 //#define ppbytes_heap_some(heap, size, pspace) _heap16_some(&(heap)->bytesheap, size, pspace)
18 #define ppbytes_heap_done(heap, data, written) heap16_done(&(heap)->bytesheap, data, written)
19 #define ppbytes_heap_clear(heap) heap16_clear(&(heap)->bytesheap)
20 #define ppbytes_heap_free(heap) heap16_free(&(heap)->bytesheap)
21 #define ppbytes_heap_info(heap, info, append) heap16_stats(&(heap)->bytesheap, info, append)
22
23 #define ppbytes_take(heap, size) _heap16_take(&(heap)->bytesheap, size)
24 #define ppbytes_buffer_init(heap) heap16_buffer_init(&(heap)->bytesheap, &(heap)->bytesbuffer)
25 #define ppbytes_buffer(heap, atleast) _heap16_buffer_some(&(heap)->bytesheap, &(heap)->bytesbuffer, atleast)
26
27 #define ppstruct_heap heap64
28 #define ppstruct_heap_init(heap, space, large, flags) (heap64_init(&(heap)->structheap, space, large, flags), heap64_head(&(heap)->structheap))
29 #define ppstruct_heap_clear(heap) heap64_clear(&(heap)->structheap)
30 #define ppstruct_heap_free(heap) heap64_free(&(heap)->structheap)
31 #define ppstruct_heap_info(heap, info, append) heap64_stats(&(heap)->structheap, info, append)
32 #define ppstruct_take(heap, size) _heap64_take(&(heap)->structheap, size)
33
34 typedef struct {
35 ppbytes_heap bytesheap;
36 ppstruct_heap structheap;
37 iof bytesbuffer;
38 } ppheap;
39
40 ppbyte * ppbytes_flush (ppheap *heap, iof *O, size_t *psize);
41
42 void ppheap_init (ppheap *heap);
43 void ppheap_free (ppheap *heap);
44 void ppheap_renew (ppheap *heap);
45
46 #endif