blame: micro-optimize cmp_suspect()
The commit structures are guaranteed their uniqueness by the object layer, so we can check their address and see if they are the same without going down to the object sha1 level. Signed-off-by: Junio C Hamano <junkio@cox.net>
Junio C Hamano committed
Mar 19, 2007 at 22:17 UTC
57584d9eddc3482c5db0308203b9df50dc62109c
1 file changed
+2
-3
builtin-blame.c
+2
-3
@@ -182,9 +182,8 @@ struct scoreboard {
182
183
static int cmp_suspect(struct origin *a, struct origin *b)
184
{
185
- int cmp = hashcmp(a->commit->object.sha1, b->commit->object.sha1);
186
- if (cmp)
187
- return cmp;
185
+ if (a->commit != b->commit)
186
+ return 1;
187
return strcmp(a->path, b->path);
188
}
189