From 85a43e54614ebf30cb700f106afff172e232e734 Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Sun, 11 Oct 2020 16:06:44 -0700 Subject: [PATCH] Added new internal header. --- upb/upb.int.h | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 upb/upb.int.h diff --git a/upb/upb.int.h b/upb/upb.int.h new file mode 100644 index 0000000000..b857560e4e --- /dev/null +++ b/upb/upb.int.h @@ -0,0 +1,29 @@ + +#ifndef UPB_INT_H_ +#define UPB_INT_H_ + +#include "upb/upb.h" + +struct mem_block; +typedef struct mem_block mem_block; + +struct upb_arena { + _upb_arena_head head; + uint32_t *cleanups; + + /* Allocator to allocate arena blocks. We are responsible for freeing these + * when we are destroyed. */ + upb_alloc *block_alloc; + uint32_t last_size; + + /* When multiple arenas are fused together, each arena points to a parent + * arena (root points to itself). The root tracks how many live arenas + * reference it. */ + uint32_t refcount; /* Only used when a->parent == a */ + struct upb_arena *parent; + + /* Linked list of blocks to free/cleanup. */ + mem_block *freelist, *freelist_tail; +}; + +#endif /* UPB_INT_H_ */