| 869 | static int cbm_initialized = 0; |
| 870 | |
| 871 | int cbm_init(void) { |
| 872 | if (cbm_initialized) { |
| 873 | return 0; |
| 874 | } |
| 875 | enum { CBM_INIT_DONE = 1 }; |
| 876 | cbm_initialized = CBM_INIT_DONE; |
| 877 | /* Defense-in-depth allocator binds (idempotent). main() calls cbm_alloc_init |
| 878 | * first; this covers non-main entry points (pipeline passes call cbm_init). |
| 879 | * For sqlite the SQLITE_CONFIG_MALLOC bind only takes effect if it runs |
| 880 | * before sqlite initializes — main() guarantees that ordering; here it is a |
| 881 | * best-effort idempotent re-assert for paths that never hit main(). */ |
| 882 | cbm_alloc_init(); |
| 883 | return 0; |
| 884 | } |
| 885 | |
| 886 | void cbm_reset_thread_parser(void) { |
| 887 | // Release parser's internal slab-allocated subtrees (stack, cached token). |