From a89fccd28197fa179828c8596791ff16e2268d20 Mon Sep 17 00:00:00 2001 From: David Rientjes Date: Thu, 17 Aug 2006 11:54:57 -0700 Subject: Do not use memcmp(sha1_1, sha1_2, 20) with hardcoded length. Introduces global inline: hashcmp(const unsigned char *sha1, const unsigned char *sha2) Uses memcmp for comparison and returns the result based on the length of the hash name (a future runtime decision). Acked-by: Alex Riesen Signed-off-by: David Rientjes Signed-off-by: Junio C Hamano --- combine-diff.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'combine-diff.c') diff --git a/combine-diff.c b/combine-diff.c index ce063b4ffa..0682acd50d 100644 --- a/combine-diff.c +++ b/combine-diff.c @@ -688,8 +688,8 @@ static void show_patch_diff(struct combine_diff_path *elem, int num_parent, for (i = 0; i < num_parent; i++) { int j; for (j = 0; j < i; j++) { - if (!memcmp(elem->parent[i].sha1, - elem->parent[j].sha1, 20)) { + if (!hashcmp(elem->parent[i].sha1, + elem->parent[j].sha1)) { reuse_combine_diff(sline, cnt, i, j); break; } -- cgit v1.2.3