mirror of
https://git.zx2c4.com/cgit
synced 2024-11-22 08:28:42 +00:00
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>
This commit is contained in:
parent
fe211c7eef
commit
f6310fec78
27
ui-summary.c
27
ui-summary.c
@ -10,21 +10,26 @@
|
||||
|
||||
static int header;
|
||||
|
||||
static int cmp_tag_age(void *a, void *b)
|
||||
static int cmp_age(int age1, int age2)
|
||||
{
|
||||
if (age1 != 0 && age2 != 0)
|
||||
return age2 - age1;
|
||||
|
||||
if (age1 == 0 && age2 == 0)
|
||||
return 0;
|
||||
|
||||
if (age1 == 0)
|
||||
return +1;
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int cmp_tag_age(const void *a, const void *b)
|
||||
{
|
||||
struct refinfo *r1 = *(struct refinfo **)a;
|
||||
struct refinfo *r2 = *(struct refinfo **)b;
|
||||
|
||||
if (r1->tag->tagger_date != 0 && r2->tag->tagger_date != 0)
|
||||
return r2->tag->tagger_date - r1->tag->tagger_date;
|
||||
|
||||
if (r1->tag->tagger_date == 0 && r2->tag->tagger_date == 0)
|
||||
return 0;
|
||||
|
||||
if (r1 == 0)
|
||||
return +1;
|
||||
|
||||
return -1;
|
||||
return cmp_age(r1->tag->tagger_date, r2->tag->tagger_date);
|
||||
}
|
||||
|
||||
static void cgit_print_branch(struct refinfo *ref)
|
||||
|
Loading…
Reference in New Issue
Block a user