From c251c83df276dc0bff4d008433268ad59b7a8df2 Mon Sep 17 00:00:00 2001 From: "brian m. carlson" Date: Sat, 6 May 2017 22:10:38 +0000 Subject: object: convert parse_object* to take struct object_id Make parse_object, parse_object_or_die, and parse_object_buffer take a pointer to struct object_id. Remove the temporary variables inserted earlier, since they are no longer necessary. Transform all of the callers using the following semantic patch: @@ expression E1; @@ - parse_object(E1.hash) + parse_object(&E1) @@ expression E1; @@ - parse_object(E1->hash) + parse_object(E1) @@ expression E1, E2; @@ - parse_object_or_die(E1.hash, E2) + parse_object_or_die(&E1, E2) @@ expression E1, E2; @@ - parse_object_or_die(E1->hash, E2) + parse_object_or_die(E1, E2) @@ expression E1, E2, E3, E4, E5; @@ - parse_object_buffer(E1.hash, E2, E3, E4, E5) + parse_object_buffer(&E1, E2, E3, E4, E5) @@ expression E1, E2, E3, E4, E5; @@ - parse_object_buffer(E1->hash, E2, E3, E4, E5) + parse_object_buffer(E1, E2, E3, E4, E5) Signed-off-by: brian m. carlson Signed-off-by: Junio C Hamano --- bundle.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'bundle.c') diff --git a/bundle.c b/bundle.c index 3386dba3be..f4abac4672 100644 --- a/bundle.c +++ b/bundle.c @@ -142,7 +142,7 @@ int verify_bundle(struct bundle_header *header, int verbose) init_revisions(&revs, NULL); for (i = 0; i < p->nr; i++) { struct ref_list_entry *e = p->list + i; - struct object *o = parse_object(e->oid.hash); + struct object *o = parse_object(&e->oid); if (o) { o->flags |= PREREQ_MARK; add_pending_object(&revs, o, e->name); @@ -290,12 +290,14 @@ static int compute_and_write_prerequisites(int bundle_fd, if (buf.len > 0 && buf.buf[0] == '-') { write_or_die(bundle_fd, buf.buf, buf.len); if (!get_oid_hex(buf.buf + 1, &oid)) { - struct object *object = parse_object_or_die(oid.hash, buf.buf); + struct object *object = parse_object_or_die(&oid, + buf.buf); object->flags |= UNINTERESTING; add_pending_object(revs, object, buf.buf); } } else if (!get_oid_hex(buf.buf, &oid)) { - struct object *object = parse_object_or_die(oid.hash, buf.buf); + struct object *object = parse_object_or_die(&oid, + buf.buf); object->flags |= SHOWN; } } @@ -379,7 +381,7 @@ static int write_bundle_refs(int bundle_fd, struct rev_info *revs) * end up triggering "empty bundle" * error. */ - obj = parse_object_or_die(oid.hash, e->name); + obj = parse_object_or_die(&oid, e->name); obj->flags |= SHOWN; add_pending_object(revs, obj, e->name); } -- cgit v1.2.1