Convert lookup_replace_object to struct object_id

Convert both the argument and the return value to be pointers to struct
object_id.  Update the callers and their internals to deal with the new
type.  Remove several temporaries which are no longer needed.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
brian m. carlson
2018-03-12 02:27:54 +00:00
committed by Junio C Hamano
parent b4f5aca40e
commit b383a13cc0
6 changed files with 42 additions and 59 deletions

View File

@ -1197,7 +1197,7 @@ static inline void *read_object_file(const struct object_id *oid, enum object_ty
* This internal function is only declared here for the benefit of
* lookup_replace_object(). Please do not call it directly.
*/
extern const unsigned char *do_lookup_replace_object(const unsigned char *sha1);
extern const struct object_id *do_lookup_replace_object(const struct object_id *oid);
/*
* If object sha1 should be replaced, return the replacement object's
@ -1205,11 +1205,11 @@ extern const unsigned char *do_lookup_replace_object(const unsigned char *sha1);
* either sha1 or a pointer to a permanently-allocated value. When
* object replacement is suppressed, always return sha1.
*/
static inline const unsigned char *lookup_replace_object(const unsigned char *sha1)
static inline const struct object_id *lookup_replace_object(const struct object_id *oid)
{
if (!check_replace_refs)
return sha1;
return do_lookup_replace_object(sha1);
return oid;
return do_lookup_replace_object(oid);
}
/* Read and unpack an object file into memory, write memory to an object file */