get_delta_base_oid(): convert to new revindex API

Replace direct accesses to the 'struct revindex' type with a call to 'pack_pos_to_index()'. Likewise drop the old-style 'find_pack_revindex()' with its replacement 'offset_to_pack_pos()' (while continuing to perform the same error checking). Signed-off-by: Taylor Blau <me@ttaylorr.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Taylor Blau committed Jan 13, 2021 at 17:24 UTC 45bef5c064e4a41c07b1ddedd7c238c1c55ae182
1 file changed +4 -4
packfile.c
+4 -4
@@ -1235,18 +1235,18 @@ static int get_delta_base_oid(struct packed_git *p,
1235 oidread(oid, base);
1236 return 0;
1237 } else if (type == OBJ_OFS_DELTA) {
1238 - struct revindex_entry *revidx;
1238 + uint32_t base_pos;
1239 off_t base_offset = get_delta_base(p, w_curs, &curpos,
1240 type, delta_obj_offset);
1241
1242 if (!base_offset)
1243 return -1;
1244
1245 - revidx = find_pack_revindex(p, base_offset);
1246 - if (!revidx)
1245 + if (offset_to_pack_pos(p, base_offset, &base_pos) < 0)
1246 return -1;
1247
1249 - return nth_packed_object_id(oid, p, revidx->nr);
1248 + return nth_packed_object_id(oid, p,
1249 + pack_pos_to_index(p, base_pos));
1250 } else
1251 return -1;
1252 }