summaryrefslogtreecommitdiff
path: root/pack-check.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2018-08-28 21:22:52 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-08-29 18:32:49 (GMT)
commit67947c34ae8f666e72b9406a38984fe8386f5e50 (patch)
treec9ae21d6995cf9011777cb9d336bfa14f4587fc5 /pack-check.c
parent9001dc2a7493f1366a183c3a9175f608769321d5 (diff)
downloadgit-67947c34ae8f666e72b9406a38984fe8386f5e50.zip
git-67947c34ae8f666e72b9406a38984fe8386f5e50.tar.gz
git-67947c34ae8f666e72b9406a38984fe8386f5e50.tar.bz2
convert "hashcmp() != 0" to "!hasheq()"
This rounds out the previous three patches, covering the inequality logic for the "hash" variant of the functions. As with the previous three, the accompanying code changes are the mechanical result of applying the coccinelle patch; see those patches for more discussion. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'pack-check.c')
-rw-r--r--pack-check.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/pack-check.c b/pack-check.c
index d3a57df..fa5f0ff 100644
--- a/pack-check.c
+++ b/pack-check.c
@@ -79,10 +79,10 @@ static int verify_packfile(struct packed_git *p,
} while (offset < pack_sig_ofs);
the_hash_algo->final_fn(hash, &ctx);
pack_sig = use_pack(p, w_curs, pack_sig_ofs, NULL);
- if (hashcmp(hash, pack_sig))
+ if (!hasheq(hash, pack_sig))
err = error("%s pack checksum mismatch",
p->pack_name);
- if (hashcmp(index_base + index_size - the_hash_algo->hexsz, pack_sig))
+ if (!hasheq(index_base + index_size - the_hash_algo->hexsz, pack_sig))
err = error("%s pack checksum does not match its index",
p->pack_name);
unuse_pack(w_curs);
@@ -180,7 +180,7 @@ int verify_pack_index(struct packed_git *p)
the_hash_algo->init_fn(&ctx);
the_hash_algo->update_fn(&ctx, index_base, (unsigned int)(index_size - the_hash_algo->rawsz));
the_hash_algo->final_fn(hash, &ctx);
- if (hashcmp(hash, index_base + index_size - the_hash_algo->rawsz))
+ if (!hasheq(hash, index_base + index_size - the_hash_algo->rawsz))
err = error("Packfile index for %s hash mismatch",
p->pack_name);
return err;