aboutsummaryrefslogtreecommitdiff
path: root/revision.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2007-03-21 10:08:25 -0700
committerJunio C Hamano <junkio@cox.net>2007-03-21 10:21:57 -0700
commit6fda5e5180c2e7c130978361aea53b4e66f36823 (patch)
tree89df3a31883fe84ae06d1c05f29fa823614eef87 /revision.c
parenta8c40471ab0851bf9a58f7dc76f121258e0690e2 (diff)
downloadgit-6fda5e5180c2e7c130978361aea53b4e66f36823.tar.gz
git-6fda5e5180c2e7c130978361aea53b4e66f36823.tar.xz
Initialize tree descriptors with a helper function rather than by hand.
This removes slightly more lines than it adds, but the real reason for doing this is that future optimizations will require more setup of the tree descriptor, and so we want to do it in one place. Also renamed the "desc.buf" field to "desc.buffer" just to trigger compiler errors for old-style manual initializations, making sure I didn't miss anything. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'revision.c')
-rw-r--r--revision.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/revision.c b/revision.c
index c680dcb8b..adc381c26 100644
--- a/revision.c
+++ b/revision.c
@@ -62,8 +62,7 @@ void mark_tree_uninteresting(struct tree *tree)
if (parse_tree(tree) < 0)
die("bad tree %s", sha1_to_hex(obj->sha1));
- desc.buf = tree->buffer;
- desc.size = tree->size;
+ init_tree_desc(&desc, tree->buffer, tree->size);
while (tree_entry(&desc, &entry)) {
if (S_ISDIR(entry.mode))
mark_tree_uninteresting(lookup_tree(entry.sha1));
@@ -275,18 +274,17 @@ int rev_same_tree_as_empty(struct rev_info *revs, struct tree *t1)
{
int retval;
void *tree;
+ unsigned long size;
struct tree_desc empty, real;
if (!t1)
return 0;
- tree = read_object_with_reference(t1->object.sha1, tree_type, &real.size, NULL);
+ tree = read_object_with_reference(t1->object.sha1, tree_type, &size, NULL);
if (!tree)
return 0;
- real.buf = tree;
-
- empty.buf = "";
- empty.size = 0;
+ init_tree_desc(&real, tree, size);
+ init_tree_desc(&empty, "", 0);
tree_difference = REV_TREE_SAME;
revs->pruning.has_changes = 0;