From bb38f2bb9d8af41981a6fcc0fcc16c8c7c36e6b5 Mon Sep 17 00:00:00 2001 From: John Hawthorn Date: Mon, 22 Sep 2014 00:30:29 -0700 Subject: Prefer score_t over double --- match.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/match.c b/match.c index 5635895..5551e13 100644 --- a/match.c +++ b/match.c @@ -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); } -- cgit v1.2.3