From b383a13cc0dbed752b69d7ad249bc857b9d3607b Mon Sep 17 00:00:00 2001 From: "brian m. carlson" Date: Mon, 12 Mar 2018 02:27:54 +0000 Subject: 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 Signed-off-by: Junio C Hamano --- replace_object.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'replace_object.c') diff --git a/replace_object.c b/replace_object.c index 232e8b8550..336357394d 100644 --- a/replace_object.c +++ b/replace_object.c @@ -92,16 +92,16 @@ static void prepare_replace_object(void) #define MAXREPLACEDEPTH 5 /* - * If a replacement for object sha1 has been set up, return the + * If a replacement for object oid has been set up, return the * replacement object's name (replaced recursively, if necessary). - * The return value is either sha1 or a pointer to a + * The return value is either oid or a pointer to a * permanently-allocated value. This function always respects replace * references, regardless of the value of check_replace_refs. */ -const unsigned char *do_lookup_replace_object(const unsigned char *sha1) +const struct object_id *do_lookup_replace_object(const struct object_id *oid) { int pos, depth = MAXREPLACEDEPTH; - const unsigned char *cur = sha1; + const struct object_id *cur = oid; prepare_replace_object(); @@ -109,11 +109,11 @@ const unsigned char *do_lookup_replace_object(const unsigned char *sha1) do { if (--depth < 0) die("replace depth too high for object %s", - sha1_to_hex(sha1)); + oid_to_hex(oid)); - pos = replace_object_pos(cur); + pos = replace_object_pos(cur->hash); if (0 <= pos) - cur = replace_object[pos]->replacement.hash; + cur = &replace_object[pos]->replacement; } while (0 <= pos); return cur; -- cgit v1.2.3