alloc.h (760B)
1 2 #ifndef BTCS_ALLOC_H 3 #define BTCS_ALLOC_H 4 5 #include "consts.h" 6 #include "script_num.h" 7 #include "misc.h" 8 9 // MAX_OPS_PER_SCRIPT * 10 #define MAX_PUSHDATA_REFS (MAX_OPS_PER_SCRIPT * MAX_STACK_SIZE) 11 #define ALLOC_PUSHDATA_BYTES (MAX_STACK_SIZE * MAX_OPS_PER_SCRIPT) 12 13 struct num * num_pool_new(u16 *ind); 14 struct num * num_pool_pop(); 15 struct num * num_pool_get(const u16 ind); 16 17 u8 *byte_pool_new(u32 len, u16 *ind); 18 u8 *byte_pool_get(int ind, u32 *len); 19 u8 *byte_pool_pop(); 20 21 struct arenas { 22 struct num *nums; 23 u8 *bytes; 24 u8 *bytes_top; 25 struct stack bytes_map; 26 int nbytes; 27 int num_count; 28 }; 29 30 void alloc_arena_sizes(struct arenas *, const int nums, const int bytes); 31 void alloc_arenas(); 32 void free_arenas(struct arenas *arenas); 33 34 #endif /* BTCS_ALLOC_H */