Commit Diff


commit - b90c30485ccda2a8a4950134cedef294b4e8e18e
commit + 0092798358749bb760eb91ae3c53bcaa5d782907
blob - 33296145a15cd5bcb096df05bfba3f21cf7fba49
blob + c56e16c42ed63d3e61347e0ae35d4eec972e82d5
--- lib/got_lib_pack.h
+++ lib/got_lib_pack.h
@@ -170,7 +170,6 @@ const struct got_error *got_packidx_init_hdr(struct go
 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 *);
blob - 6aab7a59bcf8356a23481fce002c7a4b6278024a
blob + db3c786ab7869776389551c7137e9216e02f0861
--- lib/pack.c
+++ 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 *pa
 
 		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)
@@ -455,12 +455,6 @@ got_packidx_get_object_idx_sha1(struct got_packidx *pa
 	}
 
 	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 *
blob - 599d0595e970d295d9b6f9757db86cb8a72662d8
blob + 8491283af1685286ea2072fcd623d544df16facd
--- libexec/got-read-pack/got-read-pack.c
+++ libexec/got-read-pack/got-read-pack.c
@@ -498,8 +498,7 @@ tree_path_changed(int *changed, uint8_t **buf1, uint8_
 			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_
 				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;