]> gitweb.ps.run Git - ps-cgit/blobdiff - ui-refs.c
ui-refs: simplify cmp_age logic
[ps-cgit] / ui-refs.c
index 147b66563382fb8c7140a1243f423610afa25281..0da063f140aece02dfa94f166e890fb28a10cbf6 100644 (file)
--- a/ui-refs.c
+++ b/ui-refs.c
 #include "html.h"
 #include "ui-shared.h"
 
-static int cmp_age(int age1, int age2)
+static inline 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;
+       /* age1 and age2 are assumed to be non-negative */
+       return age2 - age1;
 }
 
 static int cmp_ref_name(const void *a, const void *b)
@@ -105,7 +97,7 @@ static void print_tag_downloads(const struct cgit_repo *repo, const char *ref)
        const char *basename;
        int free_ref = 0;
 
-       if (!ref || strlen(ref) < 2)
+       if (!ref || strlen(ref) < 1)
                return;
 
        basename = cgit_repobasename(repo->url);