diff options
| author | Edward Thomson <ethomson@edwardthomson.com> | 2022-01-22 08:48:43 -0500 |
|---|---|---|
| committer | Edward Thomson <ethomson@edwardthomson.com> | 2022-04-10 15:56:57 -0400 |
| commit | 9ffa33a1a39cdee6d1a86fedb797cd30e69529a4 (patch) | |
| tree | 0884949756e85e3063404937b36af00c4066b8ae /src/libgit2/oid.h | |
| parent | 6d8c7cabd6c0435cc7d05380d766a6e0483df67c (diff) | |
| download | libgit2-9ffa33a1a39cdee6d1a86fedb797cd30e69529a4.tar.gz | |
oid: introduce `git_oid_raw_cpy`
Now that oids are type-aware, they use their type to understand how many
bytes to copy. Some callers may need to copy the raw bytes of the
object id.
This is equivalent to a memcpy that is a little more semantic.
Diffstat (limited to 'src/libgit2/oid.h')
| -rw-r--r-- | src/libgit2/oid.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/libgit2/oid.h b/src/libgit2/oid.h index bce0a27b9..abae9a4b2 100644 --- a/src/libgit2/oid.h +++ b/src/libgit2/oid.h @@ -55,6 +55,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. * |
