summaryrefslogtreecommitdiff
path: root/diffcore.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2007-10-25 11:19:10 -0700
committerJunio C Hamano <gitster@pobox.com>2007-10-26 23:18:05 -0700
commit9fb88419ba85e641006c80db53620423f37f1c93 (patch)
tree8faef69079486e3c57cbc0009073b8ae98295c0f /diffcore.h
parentcb1491b6bff20748532c9e50afc7f9d6896167a8 (diff)
downloadgit-9fb88419ba85e641006c80db53620423f37f1c93.tar.gz
Ref-count the filespecs used by diffcore
Rather than copy the filespecs when introducing new versions of them (for rename or copy detection), use a refcount and increment the count when reusing the diff_filespec. This avoids unnecessary allocations, but the real reason behind this is a future enhancement: we will want to track shared data across the copy/rename detection. In order to efficiently notice when a filespec is used by a rename, the rename machinery wants to keep track of a rename usage count which is shared across all different users of the filespec. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'diffcore.h')
-rw-r--r--diffcore.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/diffcore.h b/diffcore.h
index eb618b1ec0..30055ac5a9 100644
--- a/diffcore.h
+++ b/diffcore.h
@@ -29,6 +29,7 @@ struct diff_filespec {
void *cnt_data;
const char *funcname_pattern_ident;
unsigned long size;
+ int count; /* Reference count */
int xfrm_flags; /* for use by the xfrm */
unsigned short mode; /* file mode */
unsigned sha1_valid : 1; /* if true, use sha1 and trust mode;
@@ -43,6 +44,7 @@ struct diff_filespec {
};
extern struct diff_filespec *alloc_filespec(const char *);
+extern void free_filespec(struct diff_filespec *);
extern void fill_filespec(struct diff_filespec *, const unsigned char *,
unsigned short);