aboutsummaryrefslogtreecommitdiff
path: root/list-objects.c
diff options
context:
space:
mode:
authorChristian Couder <chriscool@tuxfamily.org>2009-04-06 21:28:36 +0200
committerJunio C Hamano <gitster@pobox.com>2009-04-07 22:12:38 -0700
commit11c211fa06fc396e8ee8132ef83e2f2763ff6976 (patch)
tree852484cc0f26ae0fd0f968b384040e591b09b9d0 /list-objects.c
parente89aa6d2f546b2d4f2d88c15ce7e343751d6922f (diff)
downloadgit-11c211fa06fc396e8ee8132ef83e2f2763ff6976.tar.gz
git-11c211fa06fc396e8ee8132ef83e2f2763ff6976.tar.xz
list-objects: add "void *data" parameter to show functions
The goal of this patch is to get rid of the "static struct rev_info revs" static variable in "builtin-rev-list.c". To do that, we need to pass the revs to the "show_commit" function in "builtin-rev-list.c" and this in turn means that the "traverse_commit_list" function in "list-objects.c" must be passed functions pointers to functions with 2 parameters instead of one. So we have to change all the callers and all the functions passed to "traverse_commit_list". Anyway this makes the code more clean and more generic, so it should be a good thing in the long run. Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'list-objects.c')
-rw-r--r--list-objects.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/list-objects.c b/list-objects.c
index c8b8375e4..208a4cb00 100644
--- a/list-objects.c
+++ b/list-objects.c
@@ -137,8 +137,9 @@ void mark_edges_uninteresting(struct commit_list *list,
}
void traverse_commit_list(struct rev_info *revs,
- void (*show_commit)(struct commit *),
- void (*show_object)(struct object_array_entry *))
+ show_commit_fn show_commit,
+ show_object_fn show_object,
+ void *data)
{
int i;
struct commit *commit;
@@ -146,7 +147,7 @@ void traverse_commit_list(struct rev_info *revs,
while ((commit = get_revision(revs)) != NULL) {
process_tree(revs, commit->tree, &objects, NULL, "");
- show_commit(commit);
+ show_commit(commit, data);
}
for (i = 0; i < revs->pending.nr; i++) {
struct object_array_entry *pending = revs->pending.objects + i;
@@ -173,7 +174,7 @@ void traverse_commit_list(struct rev_info *revs,
sha1_to_hex(obj->sha1), name);
}
for (i = 0; i < objects.nr; i++)
- show_object(&objects.objects[i]);
+ show_object(&objects.objects[i], data);
free(objects.objects);
if (revs->pending.nr) {
free(revs->pending.objects);