commit 02828bfdd5b1fe79298e576b2c28d252509fa089 from: Stefan Sperling date: Tue Jun 22 19:05:05 2021 UTC expose got_packidx_get_object_offset() for library-internal use This will be needed by a future 'gotadmin listpack' command. commit - 40e3cb72953003915373ea79578a46eb01238c15 commit + 02828bfdd5b1fe79298e576b2c28d252509fa089 blob - 2742e41a8f1213be14ec02c12f202e7000fdf08b blob + b724471532577da10261814ae16d983663c533c9 --- lib/got_lib_pack.h +++ lib/got_lib_pack.h @@ -170,6 +170,7 @@ const struct got_error *got_packidx_open(struct got_pa int, const char *, int); const struct got_error *got_packidx_close(struct got_packidx *); const struct got_error *got_packidx_get_packfile_path(char **, struct got_packidx *); +off_t got_packidx_get_object_offset(struct got_packidx *, int idx); int got_packidx_get_object_idx(struct got_packidx *, struct got_object_id *); const struct got_error *got_packidx_match_id_str_prefix( struct got_object_id_queue *, struct got_packidx *, const char *); blob - 2419035a2533dcaed1ae6f540cc4d946ca3e4202 blob + eb5f6b49d6a70c08668c91709236f37b0e9f6e6a --- lib/pack.c +++ lib/pack.c @@ -440,8 +440,8 @@ got_packidx_get_packfile_path(char **path_packfile, st return NULL; } -static off_t -get_object_offset(struct got_packidx *packidx, int idx) +off_t +got_packidx_get_object_offset(struct got_packidx *packidx, int idx) { uint32_t offset = be32toh(packidx->hdr.offsets[idx]); if (offset & GOT_PACKIDX_OFFSET_VAL_IS_LARGE_IDX) { @@ -853,7 +853,7 @@ resolve_ref_delta(struct got_delta_chain *deltas, stru if (idx == -1) return got_error(GOT_ERR_NO_OBJ); - base_offset = get_object_offset(packidx, idx); + base_offset = got_packidx_get_object_offset(packidx, idx); if (base_offset == (uint64_t)-1) return got_error(GOT_ERR_BAD_PACKIDX); @@ -956,7 +956,7 @@ got_packfile_open_object(struct got_object **obj, stru *obj = NULL; - offset = get_object_offset(packidx, idx); + offset = got_packidx_get_object_offset(packidx, idx); if (offset == (uint64_t)-1) return got_error(GOT_ERR_BAD_PACKIDX);