From 8eb36d9422a04a30ecc54fd69b4f836eafd10637 Mon Sep 17 00:00:00 2001 From: "brian m. carlson" Date: Sun, 15 Oct 2017 22:07:03 +0000 Subject: refs: convert read_ref_at to struct object_id Convert the callers and internals, including struct read_ref_at_cb, of read_ref_at to use struct object_id. Signed-off-by: brian m. carlson Signed-off-by: Junio C Hamano --- refs.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'refs.c') diff --git a/refs.c b/refs.c index f8a2d9866..d19fae507 100644 --- a/refs.c +++ b/refs.c @@ -738,11 +738,11 @@ struct read_ref_at_cb { timestamp_t at_time; int cnt; int reccnt; - unsigned char *sha1; + struct object_id *oid; int found_it; - unsigned char osha1[20]; - unsigned char nsha1[20]; + struct object_id ooid; + struct object_id noid; int tz; timestamp_t date; char **msg; @@ -774,25 +774,25 @@ static int read_ref_at_ent(struct object_id *ooid, struct object_id *noid, * we have not yet updated cb->[n|o]sha1 so they still * hold the values for the previous record. */ - if (!is_null_sha1(cb->osha1)) { - hashcpy(cb->sha1, noid->hash); - if (hashcmp(cb->osha1, noid->hash)) + if (!is_null_oid(&cb->ooid)) { + oidcpy(cb->oid, noid); + if (oidcmp(&cb->ooid, noid)) warning("Log for ref %s has gap after %s.", cb->refname, show_date(cb->date, cb->tz, DATE_MODE(RFC2822))); } else if (cb->date == cb->at_time) - hashcpy(cb->sha1, noid->hash); - else if (hashcmp(noid->hash, cb->sha1)) + oidcpy(cb->oid, noid); + else if (oidcmp(noid, cb->oid)) warning("Log for ref %s unexpectedly ended on %s.", cb->refname, show_date(cb->date, cb->tz, DATE_MODE(RFC2822))); - hashcpy(cb->osha1, ooid->hash); - hashcpy(cb->nsha1, noid->hash); + oidcpy(&cb->ooid, ooid); + oidcpy(&cb->noid, noid); cb->found_it = 1; return 1; } - hashcpy(cb->osha1, ooid->hash); - hashcpy(cb->nsha1, noid->hash); + oidcpy(&cb->ooid, ooid); + oidcpy(&cb->noid, noid); if (cb->cnt > 0) cb->cnt--; return 0; @@ -812,15 +812,15 @@ static int read_ref_at_ent_oldest(struct object_id *ooid, struct object_id *noid *cb->cutoff_tz = tz; if (cb->cutoff_cnt) *cb->cutoff_cnt = cb->reccnt; - hashcpy(cb->sha1, ooid->hash); - if (is_null_sha1(cb->sha1)) - hashcpy(cb->sha1, noid->hash); + oidcpy(cb->oid, ooid); + if (is_null_oid(cb->oid)) + oidcpy(cb->oid, noid); /* We just want the first entry */ return 1; } int read_ref_at(const char *refname, unsigned int flags, timestamp_t at_time, int cnt, - unsigned char *sha1, char **msg, + struct object_id *oid, char **msg, timestamp_t *cutoff_time, int *cutoff_tz, int *cutoff_cnt) { struct read_ref_at_cb cb; @@ -833,7 +833,7 @@ int read_ref_at(const char *refname, unsigned int flags, timestamp_t at_time, in cb.cutoff_time = cutoff_time; cb.cutoff_tz = cutoff_tz; cb.cutoff_cnt = cutoff_cnt; - cb.sha1 = sha1; + cb.oid = oid; for_each_reflog_ent_reverse(refname, read_ref_at_ent, &cb); -- cgit v1.2.1