Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
Teach notes code to free its internal data structures on request
author
Johan Herland
<johan@herland.net>
Fri, 9 Oct 2009 10:22:06 +0000
(12:22 +0200)
committer
Junio C Hamano
<gitster@pobox.com>
Tue, 20 Oct 2009 02:00:24 +0000
(19:00 -0700)
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>
notes.c
patch
|
blob
|
history
notes.h
patch
|
blob
|
history
raw
|
patch
| inline |
side by side
(parent:
8b208f0
)
diff --git
a/notes.c
b/notes.c
index b7d79e19005f3c384e8e52795746bffdb20d6e67..a5d888d77250d7d410c55ea2fdab73d1bcfd8795 100644
(file)
--- 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)
{
diff --git
a/notes.h
b/notes.h
index 7f3eed4384208a6cff16aac08d64a9dfb2dafe57..a1421e351ae0a6f97824b150140e49ddd5d3414d 100644
(file)
--- a/
notes.h
+++ b/
notes.h
@@
-1,6
+1,9
@@
#ifndef NOTES_H
#define NOTES_H
+/* Free (and de-initialize) the internal notes tree structure */
+void free_notes(void);
+
#define NOTES_SHOW_HEADER 1
#define NOTES_INDENT 2