summaryrefslogtreecommitdiff
path: root/builtin-pack-objects.c
diff options
context:
space:
mode:
authorLibravatar Linus Torvalds <torvalds@linux-foundation.org>2007-03-21 10:08:25 -0700
committerLibravatar Junio C Hamano <junkio@cox.net>2007-03-21 10:21:57 -0700
commit6fda5e5180c2e7c130978361aea53b4e66f36823 (patch)
tree89df3a31883fe84ae06d1c05f29fa823614eef87 /builtin-pack-objects.c
parentRemove "pathlen" from "struct name_entry" (diff)
downloadtgif-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 'builtin-pack-objects.c')
-rw-r--r--builtin-pack-objects.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/builtin-pack-objects.c b/builtin-pack-objects.c
index 9231b6564f..b5f9648e80 100644
--- a/builtin-pack-objects.c
+++ b/builtin-pack-objects.c
@@ -873,8 +873,7 @@ static void add_pbase_object(struct tree_desc *tree,
tree = pbase_tree_get(entry.sha1);
if (!tree)
return;
- sub.buf = tree->tree_data;
- sub.size = tree->tree_size;
+ init_tree_desc(&sub, tree->tree_data, tree->tree_size);
add_pbase_object(&sub, down, downlen, fullname);
pbase_tree_put(tree);
@@ -937,8 +936,7 @@ static void add_preferred_base_object(const char *name, unsigned hash)
}
else {
struct tree_desc tree;
- tree.buf = it->pcache.tree_data;
- tree.size = it->pcache.tree_size;
+ init_tree_desc(&tree, it->pcache.tree_data, it->pcache.tree_size);
add_pbase_object(&tree, name, cmplen, name);
}
}