diff options
author | Edward Thomson <ethomson@edwardthomson.com> | 2022-01-22 08:48:43 -0500 |
---|---|---|
committer | Edward Thomson <ethomson@edwardthomson.com> | 2022-01-26 15:25:15 -0500 |
commit | 75320d682397ed35ebb4820f03677371dd3c0cf2 (patch) | |
tree | 40f628bf02a247dbb38816ae7dae35d91ca1687a | |
parent | 6cb681822975b9e1efdb07b713d8712efcaf7288 (diff) | |
download | libgit2-75320d682397ed35ebb4820f03677371dd3c0cf2.tar.gz |
oid: introduce `git_oid_cpy_raw`
-rw-r--r-- | src/oid.c | 3 | ||||
-rw-r--r-- | src/oid.h | 8 |
2 files changed, 9 insertions, 2 deletions
@@ -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) @@ -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. * |