summaryrefslogtreecommitdiff
path: root/name-rev.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@osdl.org>2006-06-30 04:38:55 (GMT)
committerJunio C Hamano <junkio@cox.net>2006-06-30 06:48:31 (GMT)
commitfc046a75d539a78e6b2c16534c4078617a69a327 (patch)
tree03842bdfab234301a0a0c693f30c087a58eeb51f /name-rev.c
parent8dbbd14ea3ae1b4e825f1e7d314afddf26c67298 (diff)
downloadgit-fc046a75d539a78e6b2c16534c4078617a69a327.zip
git-fc046a75d539a78e6b2c16534c4078617a69a327.tar.gz
git-fc046a75d539a78e6b2c16534c4078617a69a327.tar.bz2
Abstract out accesses to object hash array
There are a few special places where some programs accessed the object hash array directly, which bothered me because I wanted to play with some simple re-organizations. So this patch makes the object hash array data structures all entirely local to object.c, and the few users who wanted to look at it now get to use a function to query how many object index entries there can be, and to actually access the array. Signed-off-by: Linus Torvalds <torvalds@osdl.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'name-rev.c')
-rw-r--r--name-rev.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/name-rev.c b/name-rev.c
index 3a5ac35..6a23f2d 100644
--- a/name-rev.c
+++ b/name-rev.c
@@ -234,12 +234,15 @@ int main(int argc, char **argv)
fwrite(p_start, p - p_start, 1, stdout);
}
} else if (all) {
- int i;
+ int i, max;
- for (i = 0; i < obj_allocs; i++)
- if (objs[i])
- printf("%s %s\n", sha1_to_hex(objs[i]->sha1),
- get_rev_name(objs[i]));
+ max = get_max_object_index();
+ for (i = 0; i < max; i++) {
+ struct object * obj = get_indexed_object(i);
+ if (!obj)
+ continue;
+ printf("%s %s\n", sha1_to_hex(obj->sha1), get_rev_name(obj));
+ }
} else {
int i;
for (i = 0; i < revs.nr; i++)