summary refs log tree commit diff
diff options
context:
space:
mode:
authorChristian Neukirchen <chneukirchen@gmail.com>2016-07-26 21:52:30 +0200
committerChristian Neukirchen <chneukirchen@gmail.com>2016-07-26 21:59:25 +0200
commit9c172de1f5e43327d355c0ce54545ef194afd1c6 (patch)
tree713b50aed3f17ffa14c3a38cf421d8be7f9eadbe
parent68042c68c76322f8d7efcd8ce5bfdabb9296a82f (diff)
downloadmblaze-9c172de1f5e43327d355c0ce54545ef194afd1c6.tar.gz
mblaze-9c172de1f5e43327d355c0ce54545ef194afd1c6.tar.xz
mblaze-9c172de1f5e43327d355c0ce54545ef194afd1c6.zip
msort: don't let fileorder fallback
-rw-r--r--msort.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/msort.c b/msort.c
index 0a1848d..9e21fb3 100644
--- a/msort.c
+++ b/msort.c
@@ -209,11 +209,7 @@ fileorder(const void *a, const void *b)
 	struct mail *ia = (struct mail *)a;
 	struct mail *ib = (struct mail *)b;
 
-	int x = mystrverscmp(a, b);
-
-	if (x != 0)
-		return x;
-	return ia->idx - ib->idx;   // XXX verify
+	return mystrverscmp(ia->file, ib->file);
 }
 
 int
@@ -222,7 +218,12 @@ idxorder(const void *a, const void *b)
 	struct mail *ia = (struct mail *)a;
 	struct mail *ib = (struct mail *)b;
 
-	return ia->idx - ib->idx;   // XXX verify
+	if (ia->idx > ib->idx)
+		return 1;
+	else if (ia->idx < ib->idx)
+		return -1;
+	else
+		return 0;
 }
 
 void