diff --git a/src/hammer.c b/src/hammer.c index 85a7fc2f33afa051302e880ce60e1c16917005bb..adcc210b501045b205d3cf42553baf586a5ae17c 100644 --- a/src/hammer.c +++ b/src/hammer.c @@ -264,6 +264,10 @@ HParseResult* h_parse(const HParser* parser, const uint8_t* input, size_t length return res; } +void h_parse_result_free(HParseResult *result) { + h_delete_arena(result->arena); +} + #ifdef INCLUDE_TESTS #include "test_suite.h" diff --git a/src/hammer.h b/src/hammer.h index 62b5676610415b0a03a9546cea7b829b3477d658..e8db7fd8ebdc69c7f7bd0d79886e2b3330b01e92 100644 --- a/src/hammer.h +++ b/src/hammer.h @@ -437,6 +437,11 @@ HParser *h_indirect(); */ void h_bind_indirect(HParser* indirect, HParser* inner); +/** + * Free the memory allocated to an HParseResult when it is no longer needed. + */ +void h_parse_result_free(HParseResult *result); + // Some debugging aids /** * Format token into a compact unambiguous form. Useful for parser test cases.