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>
brian m. carlson committed
Mar 26, 2017 at 16:01 UTC
5028bf628c7ebfb85d14ec7dc296b264a1c3bcd3
1 file changed
+5
-1
cache.h
+5
-1
@@ -66,8 +66,12 @@ unsigned long git_deflate_bound(git_zstream *, unsigned long);
66
#define GIT_SHA1_RAWSZ 20
67
#define GIT_SHA1_HEXSZ (2 * GIT_SHA1_RAWSZ)
68
69
+/* The length in byte and in hex digits of the largest possible hash value. */
70
+#define GIT_MAX_RAWSZ GIT_SHA1_RAWSZ
71
+#define GIT_MAX_HEXSZ GIT_SHA1_HEXSZ
72
+
73
struct object_id {
70
- unsigned char hash[GIT_SHA1_RAWSZ];
74
+ unsigned char hash[GIT_MAX_RAWSZ];
75
};
76
77
#if defined(DT_UNKNOWN) && !defined(NO_D_TYPE_IN_DIRENT)