about summary refs log tree commit diff stats
path: root/ui-repolist.c
diff options
context:
space:
mode:
authorPeter Colberg2015-12-08 12:53:08 -0500
committerJason A. Donenfeld2016-01-13 17:16:15 +0100
commita4014d0dbfcab1de7293179966c9b7fcfcc7b925 (patch)
tree10c9ecd90b4b78d80830c4c1346e7c8df1186dcd /ui-repolist.c
parentFix segmentation fault in hc() (diff)
downloadcgit-a4014d0dbfcab1de7293179966c9b7fcfcc7b925.tar.gz
cgit-a4014d0dbfcab1de7293179966c9b7fcfcc7b925.zip
ui-repolist: extract repo visibility criteria to separate function
Signed-off-by: Peter Colberg <peter@colberg.org>
Diffstat (limited to 'ui-repolist.c')
-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)
106 return 0; 106 return 0;
107} 107}
108 108
109static int is_visible(struct cgit_repo *repo)
110{
111 if (repo->hide || repo->ignore)
112 return 0;
113 if (!(is_match(repo) && is_in_url(repo)))
114 return 0;
115 return 1;
116}
117
109static void print_sort_header(const char *title, const char *sort) 118static void print_sort_header(const char *title, const char *sort)
110{ 119{
111 char *currenturl = cgit_currenturl(); 120 char *currenturl = cgit_currenturl();
@@ -278,9 +287,7 @@ void cgit_print_repolist(void)
278 html("<table summary='repository list' class='list nowrap'>"); 287 html("<table summary='repository list' class='list nowrap'>");
279 for (i = 0; i < cgit_repolist.count; i++) { 288 for (i = 0; i < cgit_repolist.count; i++) {
280 ctx.repo = &cgit_repolist.repos[i]; 289 ctx.repo = &cgit_repolist.repos[i];
281 if (ctx.repo->hide || ctx.repo->ignore) 290 if (!is_visible(ctx.repo))
282 continue;
283 if (!(is_match(ctx.repo) && is_in_url(ctx.repo)))
284 continue; 291 continue;
285 hits++; 292 hits++;
286 if (hits <= ctx.qry.ofs) 293 if (hits <= ctx.qry.ofs)