summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 8e21d63)
raw | patch | inline | side by side (parent: 8e21d63)
author | Nicolas Pitre <nico@cam.org> | |
Wed, 25 Jun 2008 03:17:12 +0000 (23:17 -0400) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Wed, 25 Jun 2008 06:58:57 +0000 (23:58 -0700) |
Using find_pack_entry_one() to get object offsets is rather suboptimal
when nth_packed_object_offset() can be used directly.
Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
when nth_packed_object_offset() can be used directly.
Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
cache.h | patch | blob | history | |
pack-check.c | patch | blob | history | |
sha1_file.c | patch | blob | history |
index a9c14da7a21eb7286e3af20a0aa6fee6c45cc99d..c8954ef15f28e83e4029481b1cb3cd793f7f3d58 100644 (file)
--- a/cache.h
+++ b/cache.h
extern void unuse_pack(struct pack_window **);
extern struct packed_git *add_packed_git(const char *, int, int);
extern const unsigned char *nth_packed_object_sha1(struct packed_git *, uint32_t);
+extern off_t nth_packed_object_offset(const struct packed_git *, uint32_t);
extern off_t find_pack_entry_one(const unsigned char *, struct packed_git *);
extern void *unpack_entry(struct packed_git *, off_t, enum object_type *, unsigned long *);
extern unsigned long unpack_object_header_gently(const unsigned char *buf, unsigned long len, enum object_type *type, unsigned long *sizep);
diff --git a/pack-check.c b/pack-check.c
index b99a9171c023ece7db0a387a49bdb75287bcc06f..d6dbd4b9d8ef0f93135520a6cce1ff34b7b68b6c 100644 (file)
--- a/pack-check.c
+++ b/pack-check.c
entries[i].sha1 = nth_packed_object_sha1(p, i);
if (!entries[i].sha1)
die("internal error pack-check nth-packed-object");
- entries[i].offset = find_pack_entry_one(entries[i].sha1, p);
- if (!entries[i].offset)
- die("internal error pack-check find-pack-entry-one");
+ entries[i].offset = nth_packed_object_offset(p, i);
}
qsort(entries, nr_objects, sizeof(*entries), compare_entries);
diff --git a/sha1_file.c b/sha1_file.c
index b2db549d8a61e5ffc282f7259a5187b9d1fc5706..e79b2c1145e800e88c0f6e79338d2befa2443494 100644 (file)
--- a/sha1_file.c
+++ b/sha1_file.c
}
}
-static off_t nth_packed_object_offset(const struct packed_git *p, uint32_t n)
+off_t nth_packed_object_offset(const struct packed_git *p, uint32_t n)
{
const unsigned char *index = p->index_data;
index += 4 * 256;