From fa093d3b064d96bf0b4c7f7462da8bfcc8cf0016 Mon Sep 17 00:00:00 2001
From: "Meredith L. Patterson" <mlp@thesmartpolitenerd.com>
Date: Fri, 27 Jul 2012 15:06:40 -0700
Subject: [PATCH] Added h_parse_result_free().

---
 src/hammer.c | 4 ++++
 src/hammer.h | 5 +++++
 2 files changed, 9 insertions(+)

diff --git a/src/hammer.c b/src/hammer.c
index 85a7fc2f..adcc210b 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 62b56766..e8db7fd8 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.
-- 
GitLab