diff options
author | John Hawthorn <john.hawthorn@gmail.com> | 2014-09-22 00:30:29 -0700 |
---|---|---|
committer | John Hawthorn <john.hawthorn@gmail.com> | 2014-09-27 16:50:08 -0700 |
commit | bb38f2bb9d8af41981a6fcc0fcc16c8c7c36e6b5 (patch) | |
tree | 52b794e0869b0f5f91949f9e71adac46c0442cb5 /match.c | |
parent | 549bac31115453501023e1df3b98c6016ec44e2b (diff) |
Prefer score_t over double
Diffstat (limited to 'match.c')
-rw-r--r-- | match.c | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -50,7 +50,7 @@ void mat_print(score_t *mat, const char *needle, const char *haystack){ fprintf(stderr, "\n\n"); } -double calculate_score(const char *needle, const char *haystack, size_t *positions){ +score_t calculate_score(const char *needle, const char *haystack, size_t *positions){ if(!*haystack || !*needle) return SCORE_MIN; @@ -102,8 +102,8 @@ double calculate_score(const char *needle, const char *haystack, size_t *positio } for(int i = 0; i < n; i++){ - double prev_score = SCORE_MIN; - double gap_score = i == n-1 ? SCORE_GAP_TRAILING : SCORE_GAP_INNER; + score_t prev_score = SCORE_MIN; + score_t gap_score = i == n-1 ? SCORE_GAP_TRAILING : SCORE_GAP_INNER; for(int j = 0; j < m; j++){ score_t score = SCORE_MIN; if(tolower(needle[i]) == tolower(haystack[j])){ @@ -159,7 +159,7 @@ double calculate_score(const char *needle, const char *haystack, size_t *positio return M[n-1][m-1]; } -double match_positions(const char *needle, const char *haystack, size_t *positions){ +score_t match_positions(const char *needle, const char *haystack, size_t *positions){ if(!*needle){ return SCORE_MAX; }else if(!strcasecmp(needle, haystack)){ @@ -174,6 +174,6 @@ double match_positions(const char *needle, const char *haystack, size_t *positio } } -double match(const char *needle, const char *haystack){ +score_t match(const char *needle, const char *haystack){ return match_positions(needle, haystack, NULL); } |