Browse code

No need anymore for strlen to break ties

John Hawthorn authored on 27/07/2014 06:05:46
Showing 1 changed files

  • fzy.c index 6b638f5..367289a 100644
... ...
@@ -63,13 +63,7 @@ static int cmpchoice(const void *p1, const void *p2) {
63 63
 	double score1 = choices_score[idx1];
64 64
 	double score2 = choices_score[idx2];
65 65
 
66
-	if(score1 == score2)
67
-		/* break ties by length of result */
68
-		return strlen(choices[idx1]) - strlen(choices[idx2]);
69
-	else if(score1 < score2)
70
-		return 1;
71
-	else
72
-		return -1;
66
+	return score1 - score2;
73 67
 }
74 68
 
75 69
 void run_search(char *needle){