aboutsummaryrefslogtreecommitdiff
diff refs
from: back
to: back
| flip
diff options
context:
space:
mode:
-rw-r--r--ui-refs.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/ui-refs.c b/ui-refs.c
index 0da063f..e8e308e 100644
--- a/ui-refs.c
+++ b/ui-refs.c
@@ -11,10 +11,18 @@
#include "html.h"
#include "ui-shared.h"
-static inline int cmp_age(int age1, int age2)
+static int cmp_age(int age1, int age2)
{
- /* age1 and age2 are assumed to be non-negative */
- return age2 - age1;
+ 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_ref_name(const void *a, const void *b)