remove got_packidx_get_object_idx_sha1(); it is not actually needed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
diff --git a/lib/got_lib_pack.h b/lib/got_lib_pack.h
index 3329614..c56e16c 100644
--- a/lib/got_lib_pack.h
+++ b/lib/got_lib_pack.h
@@ -170,7 +170,6 @@ const struct got_error *got_packidx_init_hdr(struct got_packidx *, int);
const struct got_error *got_packidx_open(struct got_packidx **,
const char *, int);
const struct got_error *got_packidx_close(struct got_packidx *);
-int got_packidx_get_object_idx_sha1(struct got_packidx *, uint8_t *);
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 *);
diff --git a/lib/pack.c b/lib/pack.c
index 6aab7a5..db3c786 100644
--- a/lib/pack.c
+++ b/lib/pack.c
@@ -430,9 +430,9 @@ get_object_offset(struct got_packidx *packidx, int idx)
}
int
-got_packidx_get_object_idx_sha1(struct got_packidx *packidx, uint8_t *sha1)
+got_packidx_get_object_idx(struct got_packidx *packidx, struct got_object_id *id)
{
- u_int8_t id0 = sha1[0];
+ u_int8_t id0 = id->sha1[0];
uint32_t totobj = betoh32(packidx->hdr.fanout_table[0xff]);
int left = 0, right = totobj - 1;
@@ -445,7 +445,7 @@ got_packidx_get_object_idx_sha1(struct got_packidx *packidx, uint8_t *sha1)
i = ((left + right) / 2);
oid = &packidx->hdr.sorted_ids[i];
- cmp = memcmp(sha1, oid->sha1, SHA1_DIGEST_LENGTH);
+ cmp = memcmp(id->sha1, oid->sha1, SHA1_DIGEST_LENGTH);
if (cmp == 0)
return i;
else if (cmp > 0)
@@ -457,12 +457,6 @@ got_packidx_get_object_idx_sha1(struct got_packidx *packidx, uint8_t *sha1)
return -1;
}
-int
-got_packidx_get_object_idx(struct got_packidx *packidx, struct got_object_id *id)
-{
- return got_packidx_get_object_idx_sha1(packidx, id->sha1);
-}
-
const struct got_error *
got_packidx_match_id_str_prefix(struct got_object_id_queue *matched_ids,
struct got_packidx *packidx, const char *id_str_prefix)
diff --git a/libexec/got-read-pack/got-read-pack.c b/libexec/got-read-pack/got-read-pack.c
index 599d059..8491283 100644
--- a/libexec/got-read-pack/got-read-pack.c
+++ b/libexec/got-read-pack/got-read-pack.c
@@ -498,8 +498,7 @@ tree_path_changed(int *changed, uint8_t **buf1, uint8_t **buf2,
int idx;
memcpy(id1.sha1, pte1->id, SHA1_DIGEST_LENGTH);
- idx = got_packidx_get_object_idx_sha1(packidx,
- pte1->id);
+ idx = got_packidx_get_object_idx(packidx, &id1);
if (idx == -1) {
err = got_error_no_obj(&id1);
break;
@@ -515,8 +514,7 @@ tree_path_changed(int *changed, uint8_t **buf1, uint8_t **buf2,
break;
memcpy(id2.sha1, pte2->id, SHA1_DIGEST_LENGTH);
- idx = got_packidx_get_object_idx_sha1(packidx,
- pte2->id);
+ idx = got_packidx_get_object_idx(packidx, &id2);
if (idx == -1) {
err = got_error_no_obj(&id2);
break;