[PATCH] Sort "loose" dives properly in-between trips

Linus Torvalds torvalds at linux-foundation.org
Mon Jan 7 09:11:06 PST 2013


On Mon, Jan 7, 2013 at 8:53 AM, Miika Turkia <miika.turkia at gmail.com> wrote:
> When clicking the dive trip column, the dive trips are sorted, but any
> dives that do not belong to a trip are thrown at the end of the list.

Ok, not really. It leaves them "unsorted", and it then depends on the
sort routine what happens. For me, the sort routine is stable, so they
stay in whatever position they used to be. For you, that's apparently
not the case.

However, you still leave one case unsorted: the case of both trips
being zero. Why?

Don't you want to compare when_a/when_b when trips are NULL? Turning
that "return 0" into just "return when_a - when_b;" should do that..

                  Linus


More information about the subsurface mailing list