aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Colberg <peter@colberg.org>2015-12-08 12:53:08 -0500
committerJason A. Donenfeld <Jason@zx2c4.com>2016-01-13 17:16:15 +0100
commita4014d0dbfcab1de7293179966c9b7fcfcc7b925 (patch)
tree10c9ecd90b4b78d80830c4c1346e7c8df1186dcd
parentda1b89710f5eb25297a66613ff3130b2a31cb86a (diff)
downloadpkg-cgit-a4014d0dbfcab1de7293179966c9b7fcfcc7b925.zip
pkg-cgit-a4014d0dbfcab1de7293179966c9b7fcfcc7b925.tar.gz
pkg-cgit-a4014d0dbfcab1de7293179966c9b7fcfcc7b925.tar.bz2
ui-repolist: extract repo visibility criteria to separate function
Signed-off-by: Peter Colberg <peter@colberg.org>
-rw-r--r--ui-repolist.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/ui-repolist.c b/ui-repolist.c
index 8d982c4..4912fa5 100644
--- a/ui-repolist.c
+++ b/ui-repolist.c
@@ -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)