fzy

terminal fuzzy finder picker

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

commit 3dc86d0a16b9cb6016907f939e1e220fb4c2e5f0
parent db66f1e7b223d3a833ef4ac38c5476d490654d05
Author: John Hawthorn <john@hawthorn.email>
Date:   Fri, 27 Dec 2019 17:54:34 -0800

Break early if strlen(neddle) > strlen(haystack)

This should never happen if this is called properly (match only returns
valid results if there IS a match), but it's nice to double check here.

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

diff --git a/src/match.c b/src/match.c @@ -76,7 +76,7 @@ score_t match_positions(const char *needle, const char *haystack, size_t *positi int n = strlen(needle); int m = strlen(haystack); - if (m > MATCH_MAX_LEN || n > MATCH_MAX_LEN) { + if (m > MATCH_MAX_LEN || n > m) { /* * Unreasonably large candidate: return no score * If it is a valid match it will still be returned, it will