fzy

terminal fuzzy finder picker

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

commit 038e4da552e356965e9deb6cbec2da3324fc0c75
parent 17b57ab588b54297a820dcc31f0a3b00d0066db3
Author: John Hawthorn <john.hawthorn@gmail.com>
Date:   Sat, 13 Sep 2014 22:57:26 -0700

Improve performance of has_match

Diffstat:
Mmatch.c | 12++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/match.c b/match.c @@ -9,10 +9,14 @@ int has_match(const char *needle, const char *haystack){ while(*needle){ - if(!*haystack) - return 0; - while(*haystack && tolower(*needle) == tolower(*haystack++)) - needle++; + char nch = tolower(*needle++); + for(;;){ + char ch = *haystack++; + if(!ch) + return 0; + else if(nch == tolower(ch)) + break; + } } return 1; }