summaryrefslogtreecommitdiffabout
authorLars Hjemli <hjemli@gmail.com>2008-11-29 13:27:35 (UTC)
committer Lars Hjemli <hjemli@gmail.com>2008-11-29 13:27:35 (UTC)
commit54272e60965ec6a98b49cbf67d72a4b1f5adc55b (patch) (side-by-side diff)
tree183bc1876d0c53b879627bb9fd66f2978d41929e
parentf250c1ca2ea7f35d65f639e42e8b8f0657515e5d (diff)
downloadcgit-54272e60965ec6a98b49cbf67d72a4b1f5adc55b.zip
cgit-54272e60965ec6a98b49cbf67d72a4b1f5adc55b.tar.gz
cgit-54272e60965ec6a98b49cbf67d72a4b1f5adc55b.tar.bz2
ui-repolist: sort null values last
When sorting on e.g. owner, it's not interesting to get all repos without owner at the top of the list. Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--ui-repolist.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/ui-repolist.c b/ui-repolist.c
index 0de328b..cf27cb3 100644
--- a/ui-repolist.c
+++ b/ui-repolist.c
@@ -107,27 +107,27 @@ void print_pager(int items, int pagelen, char *search)
html("<div class='pager'>");
for(i = 0; i * pagelen < items; i++)
cgit_index_link(fmt("[%d]", i+1), fmt("Page %d", i+1), NULL,
search, i * pagelen);
html("</div>");
}
static int cmp(const char *s1, const char *s2)
{
if (s1 && s2)
return strcmp(s1, s2);
if (s1 && !s2)
- return 1;
- if (s2 && !s1)
return -1;
+ if (s2 && !s1)
+ return 1;
return 0;
}
static int sort_name(const void *a, const void *b)
{
const struct cgit_repo *r1 = a;
const struct cgit_repo *r2 = b;
return cmp(r1->name, r2->name);
}
static int sort_desc(const void *a, const void *b)