diff options
| author | Stefan Eßer <se@FreeBSD.org> | 2022-08-30 18:35:22 +0000 |
|---|---|---|
| committer | Stefan Eßer <se@FreeBSD.org> | 2022-08-30 18:37:36 +0000 |
| commit | 161a37cc712bae177402d7143cb21b7d085c69c7 (patch) | |
| tree | 8eabf221dc1a31abf6f88dd6fcdb0b4e2a78fc82 /include/vector.h | |
| parent | 1576f66712876ee8b0fcc8b35fb062e1813b4fc0 (diff) | |
Diffstat (limited to 'include/vector.h')
| -rw-r--r-- | include/vector.h | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/include/vector.h b/include/vector.h index 43158ef4ba63..539b8a1ac292 100644 --- a/include/vector.h +++ b/include/vector.h @@ -427,17 +427,6 @@ bc_slabvec_init(BcVec* restrict v); char* bc_slabvec_strdup(BcVec* restrict v, const char* str); -#if BC_ENABLED - -/** - * Undoes the last allocation on the slab vector. This allows bc to have a - * heap-based stacks for strings. This is used by the bc parser. - */ -void -bc_slabvec_undo(BcVec* restrict v, size_t len); - -#endif // BC_ENABLED - /** * Clears a slab vector. This deallocates all but the first slab and clears the * first slab. @@ -460,6 +449,25 @@ bc_slabvec_print(BcVec* v, const char* func); /// A convenience macro for freeing a vector of slabs. #define bc_slabvec_free bc_vec_free +#if BC_ENABLED +#if DC_ENABLED + +/// Returns the set of slabs for the maps and the current calculator. +#define BC_VEC_MAP_SLABS (BC_IS_DC ? &vm->main_slabs : &vm->other_slabs) + +#else // DC_ENABLED + +/// Returns the set of slabs for the maps and the current calculator. +#define BC_VEC_MAP_SLABS (&vm->other_slabs) + +#endif // DC_ENABLED +#else // BC_ENABLED + +/// Returns the set of slabs for the maps and the current calculator. +#define BC_VEC_MAP_SLABS (&vm->main_slabs) + +#endif // BC_ENABLED + #ifndef _WIN32 /** |
