summaryrefslogtreecommitdiff
path: root/cache.h
diff options
context:
space:
mode:
authorbrian m. carlson <sandals@crustytoothpaste.net>2017-03-26 16:01:23 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-03-27 05:08:21 (GMT)
commit5028bf628c7ebfb85d14ec7dc296b264a1c3bcd3 (patch)
tree0bc67251ff72a4598bb06ee59a024d82997d0211 /cache.h
parent034667a458057ef1e571973a38ebbdf0045a63e9 (diff)
downloadgit-5028bf628c7ebfb85d14ec7dc296b264a1c3bcd3.zip
git-5028bf628c7ebfb85d14ec7dc296b264a1c3bcd3.tar.gz
git-5028bf628c7ebfb85d14ec7dc296b264a1c3bcd3.tar.bz2
Define new hash-size constants for allocating memory
Since we will want to transition to a new hash at some point in the future, and that hash may be larger in size than 160 bits, introduce two constants that can be used for allocating a sufficient amount of memory. They can be increased to reflect the largest supported hash size. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'cache.h')
-rw-r--r--cache.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/cache.h b/cache.h
index 2214d52..af4b2c7 100644
--- a/cache.h
+++ b/cache.h
@@ -66,8 +66,12 @@ unsigned long git_deflate_bound(git_zstream *, unsigned long);
#define GIT_SHA1_RAWSZ 20
#define GIT_SHA1_HEXSZ (2 * GIT_SHA1_RAWSZ)
+/* The length in byte and in hex digits of the largest possible hash value. */
+#define GIT_MAX_RAWSZ GIT_SHA1_RAWSZ
+#define GIT_MAX_HEXSZ GIT_SHA1_HEXSZ
+
struct object_id {
- unsigned char hash[GIT_SHA1_RAWSZ];
+ unsigned char hash[GIT_MAX_RAWSZ];
};
#if defined(DT_UNKNOWN) && !defined(NO_D_TYPE_IN_DIRENT)