summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2022-01-21 19:17:40 -0500
committerEdward Thomson <ethomson@edwardthomson.com>2022-01-26 15:24:26 -0500
commit2489e2d6884bcdb5d2cb83c3a7dcd5d4fae45173 (patch)
tree4e346379bdc823856e68d5f21f89635a71f4749d
parent7ca6cda33c2665530238e4d0ac3cd8b6c0e03ce8 (diff)
downloadlibgit2-2489e2d6884bcdb5d2cb83c3a7dcd5d4fae45173.tar.gz
oid: `hashcmp` is now `raw_cmp`
We will talk about "raw" oids as untyped blobs of data; use a name for the comparison function that is in keeping with that.
-rw-r--r--src/commit_graph.c4
-rw-r--r--src/oid.h6
-rw-r--r--src/pack.c2
3 files changed, 7 insertions, 5 deletions
diff --git a/src/commit_graph.c b/src/commit_graph.c
index 70e866b92..36f667741 100644
--- a/src/commit_graph.c
+++ b/src/commit_graph.c
@@ -147,10 +147,10 @@ static int commit_graph_parse_oid_lookup(
if (chunk_oid_lookup->length != file->num_commits * GIT_OID_RAWSZ)
return commit_graph_error("OID Lookup chunk has wrong length");
- file->oid_lookup = oid = (git_oid *)(data + chunk_oid_lookup->offset);
+ file->oid_lookup = oid = (git_oid_raw *)(data + chunk_oid_lookup->offset);
prev_oid = &zero_oid;
for (i = 0; i < file->num_commits; ++i, ++oid) {
- if (git_oid_cmp(prev_oid, oid) >= 0)
+ if (git_oid_raw_cmp(prev_oid, oid) >= 0)
return commit_graph_error("OID Lookup index is non-monotonic");
prev_oid = oid;
}
diff --git a/src/oid.h b/src/oid.h
index 84231ffca..302daedaa 100644
--- a/src/oid.h
+++ b/src/oid.h
@@ -22,7 +22,9 @@
*/
char *git_oid_allocfmt(const git_oid *id);
-GIT_INLINE(int) git_oid__hashcmp(const unsigned char *sha1, const unsigned char *sha2)
+GIT_INLINE(int) git_oid_raw_cmp(
+ const unsigned char *sha1,
+ const unsigned char *sha2)
{
return memcmp(sha1, sha2, GIT_OID_RAWSZ);
}
@@ -36,7 +38,7 @@ GIT_INLINE(int) git_oid__hashcmp(const unsigned char *sha1, const unsigned char
*/
GIT_INLINE(int) git_oid__cmp(const git_oid *a, const git_oid *b)
{
- return git_oid__hashcmp(a->id, b->id);
+ return git_oid_raw_cmp(a->id, b->id);
}
GIT_INLINE(void) git_oid__cpy_prefix(
diff --git a/src/pack.c b/src/pack.c
index 5c0cba7e8..7a6f6fccd 100644
--- a/src/pack.c
+++ b/src/pack.c
@@ -1451,7 +1451,7 @@ int git_pack__lookup_sha1(const void *oid_lookup_table, size_t stride, unsigned
while (lo < hi) {
unsigned mi = (lo + hi) / 2;
- int cmp = git_oid__hashcmp(base + mi * stride, oid_prefix);
+ int cmp = git_oid_raw_cmp(base + mi * stride, oid_prefix);
if (!cmp)
return mi;