diff options
author | brian m. carlson <sandals@crustytoothpaste.net> | 2017-03-26 16:01:25 +0000 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-03-26 22:08:21 -0700 |
commit | cd02599c480570484ec0a38a5bf66ac69ee3dd19 (patch) | |
tree | d3c301f3e0be64d16704399d36fe18019dc64a38 /builtin | |
parent | Convert GIT_SHA1_HEXSZ used for allocation to GIT_MAX_HEXSZ (diff) | |
download | tgif-cd02599c480570484ec0a38a5bf66ac69ee3dd19.tar.xz |
Convert GIT_SHA1_RAWSZ used for allocation to GIT_MAX_RAWSZ
Since we will likely be introducing a new hash function at some point,
and that hash function might be longer than 20 bytes, use the constant
GIT_MAX_RAWSZ, which is designed to be suitable for allocations, instead
of GIT_SHA1_RAWSZ. This will ease the transition down the line by
distinguishing between places where we need to allocate memory suitable
for the largest hash from those where we need to handle the current
hash.
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin')
-rw-r--r-- | builtin/patch-id.c | 2 | ||||
-rw-r--r-- | builtin/receive-pack.c | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/builtin/patch-id.c b/builtin/patch-id.c index a84d0003a3..81552e02e4 100644 --- a/builtin/patch-id.c +++ b/builtin/patch-id.c @@ -55,7 +55,7 @@ static int scan_hunk_header(const char *p, int *p_before, int *p_after) static void flush_one_hunk(struct object_id *result, git_SHA_CTX *ctx) { - unsigned char hash[GIT_SHA1_RAWSZ]; + unsigned char hash[GIT_MAX_RAWSZ]; unsigned short carry = 0; int i; diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c index fb2a090a0c..feafb076a4 100644 --- a/builtin/receive-pack.c +++ b/builtin/receive-pack.c @@ -1162,7 +1162,7 @@ static void check_aliased_update(struct command *cmd, struct string_list *list) const char *dst_name; struct string_list_item *item; struct command *dst_cmd; - unsigned char sha1[GIT_SHA1_RAWSZ]; + unsigned char sha1[GIT_MAX_RAWSZ]; int flag; strbuf_addf(&buf, "%s%s", get_git_namespace(), cmd->ref_name); |