repo_read_object_file(): stop wrapping read_object_file_extended()

The only caller of read_object_file_extended() is the thin wrapper of
repo_read_object_file(). Instead of wrapping, let's just rename the
inner function and let people call it directly. This cleans up the
namespace and reduces confusion.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Jeff King 2023-01-07 08:50:33 -05:00 committed by Junio C Hamano
parent 7be13f5f74
commit 0ba05cf2e0
2 changed files with 9 additions and 17 deletions

View File

@ -1695,10 +1695,10 @@ int pretend_object_file(void *buf, unsigned long len, enum object_type type,
* deal with them should arrange to call oid_object_info_extended() and give * deal with them should arrange to call oid_object_info_extended() and give
* error messages themselves. * error messages themselves.
*/ */
void *read_object_file_extended(struct repository *r, void *repo_read_object_file(struct repository *r,
const struct object_id *oid, const struct object_id *oid,
enum object_type *type, enum object_type *type,
unsigned long *size) unsigned long *size)
{ {
struct object_info oi = OBJECT_INFO_INIT; struct object_info oi = OBJECT_INFO_INIT;
unsigned flags = OBJECT_INFO_DIE_IF_CORRUPT | OBJECT_INFO_LOOKUP_REPLACE; unsigned flags = OBJECT_INFO_DIE_IF_CORRUPT | OBJECT_INFO_LOOKUP_REPLACE;

View File

@ -241,17 +241,10 @@ const char *loose_object_path(struct repository *r, struct strbuf *buf,
void *map_loose_object(struct repository *r, const struct object_id *oid, void *map_loose_object(struct repository *r, const struct object_id *oid,
unsigned long *size); unsigned long *size);
void *read_object_file_extended(struct repository *r, void *repo_read_object_file(struct repository *r,
const struct object_id *oid, const struct object_id *oid,
enum object_type *type, enum object_type *type,
unsigned long *size); unsigned long *size);
static inline void *repo_read_object_file(struct repository *r,
const struct object_id *oid,
enum object_type *type,
unsigned long *size)
{
return read_object_file_extended(r, oid, type, size);
}
#ifndef NO_THE_REPOSITORY_COMPATIBILITY_MACROS #ifndef NO_THE_REPOSITORY_COMPATIBILITY_MACROS
#define read_object_file(oid, type, size) repo_read_object_file(the_repository, oid, type, size) #define read_object_file(oid, type, size) repo_read_object_file(the_repository, oid, type, size)
#endif #endif
@ -358,8 +351,7 @@ void assert_oid_type(const struct object_id *oid, enum object_type expect);
/* /*
* Enabling the object read lock allows multiple threads to safely call the * Enabling the object read lock allows multiple threads to safely call the
* following functions in parallel: repo_read_object_file(), read_object_file(), * following functions in parallel: repo_read_object_file(), read_object_file(),
* read_object_file_extended(), read_object_with_reference(), * read_object_with_reference(), oid_object_info() and oid_object_info_extended().
* oid_object_info() and oid_object_info_extended().
* *
* obj_read_lock() and obj_read_unlock() may also be used to protect other * obj_read_lock() and obj_read_unlock() may also be used to protect other
* section which cannot execute in parallel with object reading. Since the used * section which cannot execute in parallel with object reading. Since the used