diff options
author | Junio C Hamano <gitster@pobox.com> | 2017-04-19 21:37:13 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-04-19 21:37:13 -0700 |
commit | b1081e4004091947b6c6a806625addd1cbba61b7 (patch) | |
tree | 2cf8dfc6a5e33499b5dbcc8b3e94dbe311e2acfa /sha1_file.c | |
parent | Merge branch 'sb/submodule-short-status' (diff) | |
parent | Documentation: update and rename api-sha1-array.txt (diff) | |
download | tgif-b1081e4004091947b6c6a806625addd1cbba61b7.tar.xz |
Merge branch 'bc/object-id'
Conversion from unsigned char [40] to struct object_id continues.
* bc/object-id:
Documentation: update and rename api-sha1-array.txt
Rename sha1_array to oid_array
Convert sha1_array_for_each_unique and for_each_abbrev to object_id
Convert sha1_array_lookup to take struct object_id
Convert remaining callers of sha1_array_lookup to object_id
Make sha1_array_append take a struct object_id *
sha1-array: convert internal storage for struct sha1_array to object_id
builtin/pull: convert to struct object_id
submodule: convert check_for_new_submodule_commits to object_id
sha1_name: convert disambiguate_hint_fn to take object_id
sha1_name: convert struct disambiguate_state to object_id
test-sha1-array: convert most code to struct object_id
parse-options-cb: convert sha1_array_append caller to struct object_id
fsck: convert init_skiplist to struct object_id
builtin/receive-pack: convert portions to struct object_id
builtin/pull: convert portions to struct object_id
builtin/diff: convert to struct object_id
Convert GIT_SHA1_RAWSZ used for allocation to GIT_MAX_RAWSZ
Convert GIT_SHA1_HEXSZ used for allocation to GIT_MAX_HEXSZ
Define new hash-size constants for allocating memory
Diffstat (limited to 'sha1_file.c')
-rw-r--r-- | sha1_file.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sha1_file.c b/sha1_file.c index 7369f7495a..2270f36a2b 100644 --- a/sha1_file.c +++ b/sha1_file.c @@ -1606,7 +1606,7 @@ static void mark_bad_packed_object(struct packed_git *p, if (!hashcmp(sha1, p->bad_object_sha1 + GIT_SHA1_RAWSZ * i)) return; p->bad_object_sha1 = xrealloc(p->bad_object_sha1, - st_mult(GIT_SHA1_RAWSZ, + st_mult(GIT_MAX_RAWSZ, st_add(p->num_bad_objects, 1))); hashcpy(p->bad_object_sha1 + GIT_SHA1_RAWSZ * p->num_bad_objects, sha1); p->num_bad_objects++; @@ -3759,7 +3759,7 @@ static int for_each_file_in_obj_subdir(int subdir_nr, strbuf_addf(path, "/%s", de->d_name); if (strlen(de->d_name) == GIT_SHA1_HEXSZ - 2) { - char hex[GIT_SHA1_HEXSZ+1]; + char hex[GIT_MAX_HEXSZ+1]; struct object_id oid; xsnprintf(hex, sizeof(hex), "%02x%s", @@ -3913,7 +3913,7 @@ static int check_stream_sha1(git_zstream *stream, const unsigned char *expected_sha1) { git_SHA_CTX c; - unsigned char real_sha1[GIT_SHA1_RAWSZ]; + unsigned char real_sha1[GIT_MAX_RAWSZ]; unsigned char buf[4096]; unsigned long total_read; int status = Z_OK; |