]> git.cameronkatri.com Git - cgit.git/commitdiff
ui-repolist: extract repo visibility criteria to separate function
authorPeter Colberg <peter@colberg.org>
Tue, 8 Dec 2015 17:53:08 +0000 (12:53 -0500)
committerJason A. Donenfeld <Jason@zx2c4.com>
Wed, 13 Jan 2016 16:16:15 +0000 (17:16 +0100)
Signed-off-by: Peter Colberg <peter@colberg.org>
ui-repolist.c

index 8d982c4ca93dce405f0a5168535ad5f3ce44b40e..4912fa55bd5628791f6bc4685f17f4219cc264bf 100644 (file)
@@ -106,6 +106,15 @@ static int is_in_url(struct cgit_repo *repo)
        return 0;
 }
 
+static int is_visible(struct cgit_repo *repo)
+{
+       if (repo->hide || repo->ignore)
+               return 0;
+       if (!(is_match(repo) && is_in_url(repo)))
+               return 0;
+       return 1;
+}
+
 static void print_sort_header(const char *title, const char *sort)
 {
        char *currenturl = cgit_currenturl();
@@ -278,9 +287,7 @@ void cgit_print_repolist(void)
        html("<table summary='repository list' class='list nowrap'>");
        for (i = 0; i < cgit_repolist.count; i++) {
                ctx.repo = &cgit_repolist.repos[i];
-               if (ctx.repo->hide || ctx.repo->ignore)
-                       continue;
-               if (!(is_match(ctx.repo) && is_in_url(ctx.repo)))
+               if (!is_visible(ctx.repo))
                        continue;
                hits++;
                if (hits <= ctx.qry.ofs)