Diff options
| author | Bryce Kwon <bryce@brycekwon.com> | |
|---|---|---|
| committer | Bryce Kwon <bryce@brycekwon.com> | |
| commit | ||
| parent | ||
| tree | ||
| download | ||
Sort with git's QSORT
QSORT skips a list of fewer than two entries, so an empty list's null
base never reaches qsort, which is what cgit_qsort was written for.
Diffstat (limited to '')
| -rw-r--r-- | source/ui-refs.c | 12 |
1 file changed, 6 insertions, 6 deletions
diff --git a/source/ui-refs.c b/source/ui-refs.c index 30f2d07..4099225 100644 --- a/source/ui-refs.c +++ b/source/ui-refs.c @@ -253,9 +253,9 @@ static void print_branches_page(int pagesize) print_branch_header(REF_COLUMNS); collect_branches(&list); - cgit_qsort(list.refs, list.count, sizeof(*list.refs), cmp_date); + QSORT(list.refs, list.count, cmp_date); if (ctx.repo->branch_sort == 0) - cgit_qsort(list.refs, list.count, sizeof(*list.refs), cmp_name); + QSORT(list.refs, list.count, cmp_name); page = page_bounds(pagesize, list.count); @@ -278,7 +278,7 @@ static void print_tags_page(int pagesize) collect_tags(&list); if (list.count == 0) return; - cgit_qsort(list.refs, list.count, sizeof(*list.refs), cmp_date); + QSORT(list.refs, list.count, cmp_date); page = page_bounds(pagesize, list.count); @@ -307,9 +307,9 @@ void cgit_print_branches(int maxcount, int columns) // The date sort covers the list, the name sort only the rows about to // be shown, so the section holds the newest branches rather than the // first ones by name. - cgit_qsort(list.refs, list.count, sizeof(*list.refs), cmp_date); + QSORT(list.refs, list.count, cmp_date); if (ctx.repo->branch_sort == 0) - cgit_qsort(list.refs, maxcount, sizeof(*list.refs), cmp_name); + QSORT(list.refs, maxcount, cmp_name); for (i = 0; i < maxcount; i++) print_branch(list.refs[i], columns); @@ -329,7 +329,7 @@ void cgit_print_tags(int maxcount, int columns) collect_tags(&list); if (list.count == 0) return; - cgit_qsort(list.refs, list.count, sizeof(*list.refs), cmp_date); + QSORT(list.refs, list.count, cmp_date); if (maxcount <= 0 || maxcount > list.count) maxcount = list.count; print_tag_header(columns); |
