summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2022-01-22 08:48:43 -0500
committerEdward Thomson <ethomson@edwardthomson.com>2022-01-26 15:25:15 -0500
commit75320d682397ed35ebb4820f03677371dd3c0cf2 (patch)
tree40f628bf02a247dbb38816ae7dae35d91ca1687a
parent6cb681822975b9e1efdb07b713d8712efcaf7288 (diff)
downloadlibgit2-75320d682397ed35ebb4820f03677371dd3c0cf2.tar.gz
oid: introduce `git_oid_cpy_raw`
-rw-r--r--src/oid.c3
-rw-r--r--src/oid.h8
2 files changed, 9 insertions, 2 deletions
diff --git a/src/oid.c b/src/oid.c
index 054929e6a..74c7934e1 100644
--- a/src/oid.c
+++ b/src/oid.c
@@ -180,8 +180,7 @@ int git_oid_fromraw(git_oid *out, const unsigned char *raw)
int git_oid_cpy(git_oid *out, const git_oid *src)
{
- memcpy(out->id, src->id, sizeof(out->id));
- return 0;
+ return git_oid_raw_cpy(out->id, src->id);
}
int git_oid_cmp(const git_oid *a, const git_oid *b)
diff --git a/src/oid.h b/src/oid.h
index ac87fc1b6..8a01574d2 100644
--- a/src/oid.h
+++ b/src/oid.h
@@ -52,6 +52,14 @@ GIT_INLINE(int) git_oid_raw_cmp(
return memcmp(sha1, sha2, GIT_OID_RAWSZ);
}
+GIT_INLINE(int) git_oid_raw_cpy(
+ unsigned char *dst,
+ const unsigned char *src)
+{
+ memcpy(dst, src, GIT_OID_RAWSZ);
+ return 0;
+}
+
/*
* Compare two oid structures.
*