summaryrefslogtreecommitdiff
path: root/read-cache.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 /read-cache.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 'read-cache.c')
-rw-r--r--read-cache.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/read-cache.c b/read-cache.c
index 88bb803..421a7f4 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -1668,7 +1668,7 @@ static int verify_hdr(struct cache_header *hdr, unsigned long size)
the_hash_algo->init_fn(&c);
the_hash_algo->update_fn(&c, hdr, size - the_hash_algo->rawsz);
the_hash_algo->final_fn(hash, &c);
- if (hashcmp(hash, (unsigned char *)hdr + size - the_hash_algo->rawsz))
+ if (!hasheq(hash, (unsigned char *)hdr + size - the_hash_algo->rawsz))
return error("bad index file sha1 signature");
return 0;
}
@@ -2395,7 +2395,7 @@ static int verify_index_from(const struct index_state *istate, const char *path)
if (n != the_hash_algo->rawsz)
goto out;
- if (hashcmp(istate->oid.hash, hash))
+ if (!hasheq(istate->oid.hash, hash))
goto out;
close(fd);