Browse code

We can use D[][] to test if there was a match

John Hawthorn authored on 31/08/2014 02:31:16
Showing 1 changed files

  • match.c index a50aab3..ea73e8f 100644
... ...
@@ -155,7 +155,7 @@ double calculate_score(const char *needle, const char *haystack, size_t *positio
155 155
 				 * we encounter, the latest in the candidate
156 156
 				 * string.
157 157
 				 */
158
-				if(tolower(needle[i]) == tolower(haystack[j]) && D[i][j] == M[i][j]){
158
+				if(D[i][j] != SCORE_MIN && D[i][j] == M[i][j]){
159 159
 					positions[i] = j--;
160 160
 					break;
161 161
 				}