Commit 5e2a29a7 by Carlos Martín Nieto

commit_list: fix the date comparison function

This returns the integer-cast truth value comparing the dates. What we
want instead of a (-1, 0, 1) output depending on how they compare.
parent 48c64362
...@@ -13,10 +13,15 @@ ...@@ -13,10 +13,15 @@
int git_commit_list_time_cmp(const void *a, const void *b) int git_commit_list_time_cmp(const void *a, const void *b)
{ {
const git_commit_list_node *commit_a = a; int64_t time_a = ((git_commit_list_node *) a)->time;
const git_commit_list_node *commit_b = b; int64_t time_b = ((git_commit_list_node *) b)->time;
return (commit_a->time < commit_b->time); if (time_a < time_b)
return 1;
if (time_a > time_b)
return -1;
return 0;
} }
git_commit_list *git_commit_list_insert(git_commit_list_node *item, git_commit_list **list_p) git_commit_list *git_commit_list_insert(git_commit_list_node *item, git_commit_list **list_p)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment