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 <raa.lkml@gmail.com>
Signed-off-by: David Rientjes <rientjes@google.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
diff --git a/tree-diff.c b/tree-diff.c
index 916f489..7e2f4f0 100644
--- a/tree-diff.c
+++ b/tree-diff.c
@@ -39,8 +39,7 @@
 		show_entry(opt, "+", t2, base);
 		return 1;
 	}
-	if (!opt->find_copies_harder &&
-	    !memcmp(sha1, sha2, 20) && mode1 == mode2)
+	if (!opt->find_copies_harder && !hashcmp(sha1, sha2) && mode1 == mode2)
 		return 0;
 
 	/*