[gtk/wip/otte/sortlistmodel] mergesort: Fix up an off-by-one error
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/otte/sortlistmodel] mergesort: Fix up an off-by-one error
- Date: Fri, 10 Jul 2020 17:19:47 +0000 (UTC)
commit 8f71a20a7c78fe5de4e6699f85199e6687cc37e9
Author: Matthias Clasen <mclasen redhat com>
Date: Fri Jul 10 13:06:15 2020 -0400
mergesort: Fix up an off-by-one error
This makes the sort-performance test not crash.
I have only done minimal checks that it still
sorts correctly.
gtk/gtksor5listmodel.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
---
diff --git a/gtk/gtksor5listmodel.c b/gtk/gtksor5listmodel.c
index 1111cd8777..133082240e 100644
--- a/gtk/gtksor5listmodel.c
+++ b/gtk/gtksor5listmodel.c
@@ -157,7 +157,10 @@ merge (SortArray *items,
GtkSorter *sorter)
{
int start2 = mid + 1;
- int c = 1;
+ int c = 0;
+
+ if (mid == end)
+ return 0;
if (gtk_sorter_compare (sorter,
sort_array_get (items, mid),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]