summaryrefslogtreecommitdiff
path: root/notes.c
diff options
context:
space:
mode:
authorJohan Herland <johan@herland.net>2009-10-09 10:22:06 (GMT)
committerJunio C Hamano <gitster@pobox.com>2009-10-20 02:00:24 (GMT)
commit27d57564102a98950bf4398daeeb14a15154478f (patch)
tree15fe36c21f7d7efa2addd96eebd7394b28f2bf5b /notes.c
parent8b208f0213ed349ecb2ab8f7bb6c5072f8011a70 (diff)
downloadgit-27d57564102a98950bf4398daeeb14a15154478f.zip
git-27d57564102a98950bf4398daeeb14a15154478f.tar.gz
git-27d57564102a98950bf4398daeeb14a15154478f.tar.bz2
Teach notes code to free its internal data structures on request
There's no need to be rude to memory-concious callers... This patch has been improved by the following contributions: - Junio C Hamano: avoid old-style declaration Signed-off-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Johan Herland <johan@herland.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'notes.c')
-rw-r--r--notes.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/notes.c b/notes.c
index b7d79e1..a5d888d 100644
--- a/notes.c
+++ b/notes.c
@@ -105,6 +105,13 @@ static unsigned char *lookup_notes(const unsigned char *commit_sha1)
return hash_map.entries[index].notes_sha1;
}
+void free_notes(void)
+{
+ free(hash_map.entries);
+ memset(&hash_map, 0, sizeof(struct hash_map));
+ initialized = 0;
+}
+
void get_commit_notes(const struct commit *commit, struct strbuf *sb,
const char *output_encoding, int flags)
{