[PATCHv6 10/14] Teach notes code to free its internal data structures on request.
There's no need to be rude to memory-concious callers...
Signed-off-by: Johan Herland <johan@herland.net>
---
notes.c | 7 +++++++
notes.h | 2 ++
2 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/notes.c b/notes.c
index 84c30c1..008c3d4 100644
--- a/notes.c
+++ b/notes.c
@@ -160,3 +160,10 @@ void get_commit_notes(const struct commit *commit, struct strbuf *sb,
free(msg);
}
+
+void free_commit_notes()
+{
+ free(hash_map.entries);
+ memset(&hash_map, 0, sizeof(struct hash_map));
+ initialized = 0;
+}
diff --git a/notes.h b/notes.h
index 7f3eed4..41802e5 100644
--- a/notes.h
+++ b/notes.h
@@ -7,4 +7,6 @@
void get_commit_notes(const struct commit *commit, struct strbuf *sb,
const char *output_encoding, int flags);
+void free_commit_notes();
+
#endif
--
1.6.4.304.g1365c.dirty