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 <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
a9dbc17910
commit
c251c83df2
10
bundle.c
10
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);
|
||||
}
|
||||
|
Reference in New Issue
Block a user