fzy

terminal fuzzy finder picker

git clone https://9o.is/git/fzy.git

commit fab2e7b704f20ffc87957bbca6ce8abc49047030
parent c30a2ea67caa41447bbfe63cbf15d3ee1da7704e
Author: John Hawthorn <john@hawthorn.email>
Date:   Fri, 27 Dec 2019 19:09:11 -0800

Remove strlen in precompute_bonus

Pretty sure this was optimized out anyways, but this is cleaner IMO.

Diffstat:
Msrc/match.c | 3+--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git 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;