Signed-off-by: Stefan Beller <sbeller@xxxxxxxxxx> --- object-store.h | 10 +++++----- sha1_file.c | 11 ++++++----- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/object-store.h b/object-store.h index 974f2de78d..47c38170e3 100644 --- a/object-store.h +++ b/object-store.h @@ -82,14 +82,14 @@ struct packed_git { char pack_name[FLEX_ARRAY]; /* more */ }; -#define read_sha1_file_extended(r, s, t, sz, l) read_sha1_file_extended_##r(s, t, sz, l) -extern void *read_sha1_file_extended_the_repository(const unsigned char *sha1, +extern void *read_sha1_file_extended(struct repository *r, + const unsigned char *sha1, enum object_type *type, unsigned long *size, int lookup_replace); -#define read_sha1_file(r, s, t, sz) read_sha1_file_##r(s, t, sz) -static inline void *read_sha1_file_the_repository(const unsigned char *sha1, enum object_type *type, unsigned long *size) + +static inline void *read_sha1_file(struct repository *r, const unsigned char *sha1, enum object_type *type, unsigned long *size) { - return read_sha1_file_extended(the_repository, sha1, type, size, 1); + return read_sha1_file_extended(r, sha1, type, size, 1); } /* Read and unpack a sha1 file into memory, write memory to a sha1 file */ diff --git a/sha1_file.c b/sha1_file.c index 6164ba29c5..743ada360d 100644 --- a/sha1_file.c +++ b/sha1_file.c @@ -1356,7 +1356,8 @@ int pretend_sha1_file(void *buf, unsigned long len, enum object_type type, * deal with them should arrange to call read_object() and give error * messages themselves. */ -void *read_sha1_file_extended_the_repository(const unsigned char *sha1, +void *read_sha1_file_extended(struct repository *r, + const unsigned char *sha1, enum object_type *type, unsigned long *size, int lookup_replace) @@ -1366,10 +1367,10 @@ void *read_sha1_file_extended_the_repository(const unsigned char *sha1, const char *path; struct stat st; const unsigned char *repl = lookup_replace ? - lookup_replace_object(the_repository, sha1) : sha1; + lookup_replace_object(r, sha1) : sha1; errno = 0; - data = read_object(the_repository, repl, type, size); + data = read_object(r, repl, type, size); if (data) return data; @@ -1381,11 +1382,11 @@ void *read_sha1_file_extended_the_repository(const unsigned char *sha1, die("replacement %s not found for %s", sha1_to_hex(repl), sha1_to_hex(sha1)); - if (!stat_sha1_file(the_repository, repl, &st, &path)) + if (!stat_sha1_file(r, repl, &st, &path)) die("loose object %s (stored in %s) is corrupt", sha1_to_hex(repl), path); - if ((p = has_packed_and_bad(the_repository, repl)) != NULL) + if ((p = has_packed_and_bad(r, repl)) != NULL) die("packed object %s (stored in %s) is corrupt", sha1_to_hex(repl), p->pack_name); -- 2.15.1.433.g936d1b9894.dirty