aboutsummaryrefslogtreecommitdiffstats
path: root/ui-summary.c
diff options
context:
space:
mode:
authorGravatar Lars Hjemli <hjemli@gmail.com>2007-10-27 17:06:03 (JST)
committerGravatar Lars Hjemli <hjemli@gmail.com>2007-10-27 17:53:27 (JST)
commitf6310fec783d2721ef61815a0eec525d6a904452 (patch)
tree04882b1a89dcbaaaec17ceca8a5210f92dd6f920 /ui-summary.c
parentfe211c7eef6c7d3e39486d6a7484d3b4debff88f (diff)
downloadcgit-f6310fec783d2721ef61815a0eec525d6a904452.zip
cgit-f6310fec783d2721ef61815a0eec525d6a904452.tar.gz
Move logic for age comparision from cmp_tag_age into cmp_age()
Simple refactoring to enable later filtering of branches based on age. Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Diffstat (limited to 'ui-summary.c')
-rw-r--r--ui-summary.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/ui-summary.c b/ui-summary.c
index 3d5eda8..05170cc 100644
--- a/ui-summary.c
+++ b/ui-summary.c
@@ -10,23 +10,28 @@
10 10
11static int header; 11static int header;
12 12
13static int cmp_tag_age(void *a, void *b) 13static int cmp_age(int age1, int age2)
14{ 14{
15 struct refinfo *r1 = *(struct refinfo **)a; 15 if (age1 != 0 && age2 != 0)
16 struct refinfo *r2 = *(struct refinfo **)b; 16 return age2 - age1;
17
18 if (r1->tag->tagger_date != 0 && r2->tag->tagger_date != 0)
19 return r2->tag->tagger_date - r1->tag->tagger_date;
20 17
21 if (r1->tag->tagger_date == 0 && r2->tag->tagger_date == 0) 18 if (age1 == 0 && age2 == 0)
22 return 0; 19 return 0;
23 20
24 if (r1 == 0) 21 if (age1 == 0)
25 return +1; 22 return +1;
26 23
27 return -1; 24 return -1;
28} 25}
29 26
27static int cmp_tag_age(const void *a, const void *b)
28{
29 struct refinfo *r1 = *(struct refinfo **)a;
30 struct refinfo *r2 = *(struct refinfo **)b;
31
32 return cmp_age(r1->tag->tagger_date, r2->tag->tagger_date);
33}
34
30static void cgit_print_branch(struct refinfo *ref) 35static void cgit_print_branch(struct refinfo *ref)
31{ 36{
32 struct commit *commit; 37 struct commit *commit;