From e1a48d0808cfc0c817ec78ab6b9e891676a2e62b Mon Sep 17 00:00:00 2001 From: John Hawthorn Date: Fri, 27 Dec 2019 19:09:11 -0800 Subject: Remove strlen in precompute_bonus Pretty sure this was optimized out anyways, but this is cleaner IMO. --- src/match.c | 3 +-- 1 file changed, 1 insertion(+), 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; -- cgit v1.2.3