diff options
author | John Hawthorn <john@hawthorn.email> | 2019-12-27 19:09:11 -0800 |
---|---|---|
committer | John Hawthorn <john@hawthorn.email> | 2019-12-27 22:25:01 -0800 |
commit | e1a48d0808cfc0c817ec78ab6b9e891676a2e62b (patch) | |
tree | a4df2c2e2dbbd278293e8cbec6a6ac23489e11ad | |
parent | 9dfb287b86b431d57dd67464aaa1a5863d63e078 (diff) |
Remove strlen in precompute_bonus
Pretty sure this was optimized out anyways, but this is cleaner IMO.
-rw-r--r-- | src/match.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/src/match.c b/src/match.c index b5c134b..4aaf1b4 100644 --- a/src/match.c +++ b/src/match.c @@ -46,9 +46,8 @@ struct match_struct { static void precompute_bonus(const char *haystack, score_t *match_bonus) { /* Which positions are beginning of words */ - int m = strlen(haystack); char last_ch = '/'; - for (int i = 0; i < m; i++) { + for (int i = 0; haystack[i]; i++) { char ch = haystack[i]; match_bonus[i] = COMPUTE_BONUS(last_ch, ch); last_ch = ch; |