summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2022-01-22 23:10:03 -0500
committerEdward Thomson <ethomson@edwardthomson.com>2022-06-14 22:29:57 -0400
commitdbc4ac1c76827e954e0aa27afe8bb7e0b8993a93 (patch)
tree56f18a11bca8d17490a176cddf9e3756c2cebe91 /include
parentf98dd5438f8d7bfd557b612fdf1605b1c3fb8eaf (diff)
downloadlibgit2-dbc4ac1c76827e954e0aa27afe8bb7e0b8993a93.tar.gz
oid: `GIT_OID_*SZ` is now `GIT_OID_SHA1_*SIZE`
In preparation for SHA256 support, `GIT_OID_RAWSZ` and `GIT_OID_HEXSZ` need to indicate that they're the size of _SHA1_ OIDs.
Diffstat (limited to 'include')
-rw-r--r--include/git2/diff.h2
-rw-r--r--include/git2/odb.h4
-rw-r--r--include/git2/oid.h10
-rw-r--r--include/git2/sys/odb_backend.h2
4 files changed, 9 insertions, 9 deletions
diff --git a/include/git2/diff.h b/include/git2/diff.h
index 3839f0033..850d215a6 100644
--- a/include/git2/diff.h
+++ b/include/git2/diff.h
@@ -274,7 +274,7 @@ typedef struct {
/**
* Represents the known length of the `id` field, when
- * converted to a hex string. It is generally `GIT_OID_HEXSZ`, unless this
+ * converted to a hex string. It is generally `GIT_OID_SHA1_HEXSIZE`, unless this
* delta was created from reading a patch file, in which case it may be
* abbreviated to something reasonable, like 7 characters.
*/
diff --git a/include/git2/odb.h b/include/git2/odb.h
index 0ffe3f328..54c38a477 100644
--- a/include/git2/odb.h
+++ b/include/git2/odb.h
@@ -117,7 +117,7 @@ GIT_EXTERN(int) git_odb_read(git_odb_object **out, git_odb *db, const git_oid *i
* This method queries all available ODB backends
* trying to match the 'len' first hexadecimal
* characters of the 'short_id'.
- * The remaining (GIT_OID_HEXSZ-len)*4 bits of
+ * The remaining (GIT_OID_SHA1_HEXSIZE-len)*4 bits of
* 'short_id' must be 0s.
* 'len' must be at least GIT_OID_MINPREFIXLEN,
* and the prefix must be long enough to identify
@@ -218,7 +218,7 @@ typedef struct git_odb_expand_id {
*
* The given array will be updated in place: for each abbreviated ID that is
* unique in the database, and of the given type (if specified),
- * the full object ID, object ID length (`GIT_OID_HEXSZ`) and type will be
+ * the full object ID, object ID length (`GIT_OID_SHA1_HEXSIZE`) and type will be
* written back to the array. For IDs that are not found (or are ambiguous),
* the array entry will be zeroed.
*
diff --git a/include/git2/oid.h b/include/git2/oid.h
index 549df4eab..0d0f05489 100644
--- a/include/git2/oid.h
+++ b/include/git2/oid.h
@@ -20,10 +20,10 @@
GIT_BEGIN_DECL
/** Size (in bytes) of a raw/binary oid */
-#define GIT_OID_RAWSZ 20
+#define GIT_OID_SHA1_SIZE 20
/** Size (in bytes) of a hex formatted oid */
-#define GIT_OID_HEXSZ (GIT_OID_RAWSZ * 2)
+#define GIT_OID_SHA1_HEXSIZE (GIT_OID_SHA1_SIZE * 2)
/** Minimum length (in number of hex characters,
* i.e. packets of 4 bits) of an oid prefix */
@@ -32,7 +32,7 @@ GIT_BEGIN_DECL
/** Unique identity of any object (commit, tree, blob, tag). */
typedef struct git_oid {
/** raw binary formatted id */
- unsigned char id[GIT_OID_RAWSZ];
+ unsigned char id[GIT_OID_SHA1_SIZE];
} git_oid;
/**
@@ -94,7 +94,7 @@ GIT_EXTERN(int) git_oid_fmt(char *out, const git_oid *id);
* Format a git_oid into a partial hex string.
*
* @param out output hex string; you say how many bytes to write.
- * If the number of bytes is > GIT_OID_HEXSZ, extra bytes
+ * If the number of bytes is > GIT_OID_SHA1_HEXSIZE, extra bytes
* will be zeroed; if not, a '\0' terminator is NOT added.
* @param n number of characters to write into out string
* @param id oid structure to format.
@@ -134,7 +134,7 @@ GIT_EXTERN(char *) git_oid_tostr_s(const git_oid *oid);
/**
* Format a git_oid into a buffer as a hex format c-string.
*
- * If the buffer is smaller than GIT_OID_HEXSZ+1, then the resulting
+ * If the buffer is smaller than GIT_OID_SHA1_HEXSIZE+1, then the resulting
* oid c-string will be truncated to n-1 characters (but will still be
* NUL-byte terminated).
*
diff --git a/include/git2/sys/odb_backend.h b/include/git2/sys/odb_backend.h
index 8598f94e5..c42abd370 100644
--- a/include/git2/sys/odb_backend.h
+++ b/include/git2/sys/odb_backend.h
@@ -36,7 +36,7 @@ struct git_odb_backend {
void **, size_t *, git_object_t *, git_odb_backend *, const git_oid *);
/* To find a unique object given a prefix of its oid. The oid given
- * must be so that the remaining (GIT_OID_HEXSZ - len)*4 bits are 0s.
+ * must be so that the remaining (GIT_OID_SHA1_HEXSIZE - len)*4 bits are 0s.
*/
int GIT_CALLBACK(read_prefix)(
git_oid *, void **, size_t *, git_object_t *,