|
...
|
...
|
@@ -50,7 +50,7 @@ void mat_print(score_t *mat, const char *needle, const char *haystack){
|
|
50
|
50
|
fprintf(stderr, "\n\n");
|
|
51
|
51
|
}
|
|
52
|
52
|
|
|
53
|
|
-double calculate_score(const char *needle, const char *haystack, size_t *positions){
|
|
|
53
|
+score_t calculate_score(const char *needle, const char *haystack, size_t *positions){
|
|
54
|
54
|
if(!*haystack || !*needle)
|
|
55
|
55
|
return SCORE_MIN;
|
|
56
|
56
|
|
|
...
|
...
|
@@ -102,8 +102,8 @@ double calculate_score(const char *needle, const char *haystack, size_t *positio
|
|
102
|
102
|
}
|
|
103
|
103
|
|
|
104
|
104
|
for(int i = 0; i < n; i++){
|
|
105
|
|
- double prev_score = SCORE_MIN;
|
|
106
|
|
- double gap_score = i == n-1 ? SCORE_GAP_TRAILING : SCORE_GAP_INNER;
|
|
|
105
|
+ score_t prev_score = SCORE_MIN;
|
|
|
106
|
+ score_t gap_score = i == n-1 ? SCORE_GAP_TRAILING : SCORE_GAP_INNER;
|
|
107
|
107
|
for(int j = 0; j < m; j++){
|
|
108
|
108
|
score_t score = SCORE_MIN;
|
|
109
|
109
|
if(tolower(needle[i]) == tolower(haystack[j])){
|
|
...
|
...
|
@@ -159,7 +159,7 @@ double calculate_score(const char *needle, const char *haystack, size_t *positio
|
|
159
|
159
|
return M[n-1][m-1];
|
|
160
|
160
|
}
|
|
161
|
161
|
|
|
162
|
|
-double match_positions(const char *needle, const char *haystack, size_t *positions){
|
|
|
162
|
+score_t match_positions(const char *needle, const char *haystack, size_t *positions){
|
|
163
|
163
|
if(!*needle){
|
|
164
|
164
|
return SCORE_MAX;
|
|
165
|
165
|
}else if(!strcasecmp(needle, haystack)){
|
|
...
|
...
|
@@ -174,6 +174,6 @@ double match_positions(const char *needle, const char *haystack, size_t *positio
|
|
174
|
174
|
}
|
|
175
|
175
|
}
|
|
176
|
176
|
|
|
177
|
|
-double match(const char *needle, const char *haystack){
|
|
|
177
|
+score_t match(const char *needle, const char *haystack){
|
|
178
|
178
|
return match_positions(needle, haystack, NULL);
|
|
179
|
179
|
}
|