From: Johan Herland Date: Sat, 12 Sep 2009 16:08:44 GMT Subject: [PATCHv6 10/14] Teach notes code to free its internal data structures on request. Message-ID: <1252771728-27206-11-git-send-email-johan@herland.net> In-Reply-To: <200909121752.07523.johan@herland.net> There's no need to be rude to memory-concious callers... Signed-off-by: Johan Herland --- 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