Initialize a stack with the given initial capacity, arena-allocated. */
| 24 | |
| 25 | /* Initialize a stack with the given initial capacity, arena-allocated. */ |
| 26 | static inline void ts_nstack_init(TSNodeStack *s, CBMArena *arena, int initial_cap) { |
| 27 | s->items = (TSNode *)cbm_arena_alloc(arena, (size_t)initial_cap * sizeof(TSNode)); |
| 28 | s->count = 0; |
| 29 | s->cap = s->items ? initial_cap : 0; |
| 30 | } |
| 31 | |
| 32 | /* Push a node onto the stack, growing 2x if needed. */ |
| 33 | static inline void ts_nstack_push(TSNodeStack *s, CBMArena *arena, TSNode node) { |
no test coverage detected