summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <junkio@cox.net>2007-03-19 22:17:10 -0700
committerLibravatar Junio C Hamano <junkio@cox.net>2007-03-19 22:17:10 -0700
commit57584d9eddc3482c5db0308203b9df50dc62109c (patch)
tree304186ea149dceee7b461054f8c8b99017abf09d
parentReplace remaining instances of strdup with xstrdup. (diff)
downloadtgif-57584d9eddc3482c5db0308203b9df50dc62109c.tar.xz
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>
-rw-r--r--builtin-blame.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/builtin-blame.c b/builtin-blame.c
index b51cdc71fa..104521e673 100644
--- a/builtin-blame.c
+++ b/builtin-blame.c
@@ -182,9 +182,8 @@ struct scoreboard {
static int cmp_suspect(struct origin *a, struct origin *b)
{
- int cmp = hashcmp(a->commit->object.sha1, b->commit->object.sha1);
- if (cmp)
- return cmp;
+ if (a->commit != b->commit)
+ return 1;
return strcmp(a->path, b->path);
}