commit db74143362d279e09ed7f5a4cad83bb7590f2dc6
parent dd0e1327e91cc492516ad7b8f2c9284f011a5714
Author: William Casarin <jb55@jb55.com>
Date: Sun, 12 Nov 2017 15:07:50 -0800
alloc: char -> u8 for some things
Diffstat:
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/alloc.c b/alloc.c
@@ -18,7 +18,7 @@ alloc_arena_sizes(struct arenas *arenas, const int nums, const int bytes) {
if (!arenas) arenas = &g_arenas;
arenas->nums = (struct num*)calloc(nums, sizeof(struct num));
assert(arenas->nums);
- arenas->bytes = (char*)calloc(bytes, 1);
+ arenas->bytes = (u8*)calloc(bytes, 1);
stack_init_size(&arenas->bytes_map, bytes);
arenas->bytes_top = arenas->bytes;
arenas->nbytes = bytes;
@@ -66,7 +66,7 @@ byte_pool_new(const u16 len, u16 *ind) {
// useful for quick alloc/deallocs
u8 *
byte_pool_pop() {
- char *p = (char*)stack_pop(&g_arenas.bytes_map);
+ u8 *p = (u8*)stack_pop(&g_arenas.bytes_map);
u16 *c = (u16*)p;
memset(p, 0, *c + sizeof(u16));
return p;
@@ -75,7 +75,7 @@ byte_pool_pop() {
u8 *
byte_pool_get(const int ind, u16 *len) {
- char *p;
+ u8 *p;
u16 *up;
p = (u8*)(g_arenas.bytes_map.bottom + ind);
assert(p);
diff --git a/alloc.h b/alloc.h
@@ -14,8 +14,8 @@ struct num * num_pool_new(int *ind);
struct num * num_pool_pop();
struct num * num_pool_get(const int ind);
-u8 *byte_pool_new(const u16 len, u16 *ind);
-u8 *byte_pool_get(const int ind, u16 *len);
+u8 *byte_pool_new(u16 len, u16 *ind);
+u8 *byte_pool_get(int ind, u16 *len);
u8 *byte_pool_pop();
struct arenas {