nvim-telescope / telescope-fzf-native.nvim

FZF sorter for telescope written in c
1.36k stars 45 forks source link

refactor position to reduce allocations #60

Closed Conni2461 closed 2 years ago

Conni2461 commented 2 years ago

new signature. Rather than having

fzf_result_t fzf_fuzzy_match_v1(bool case_sensitive, bool normalize,
                                const char *text, const char *pattern,
                                bool with_pos, fzf_slab_t *slab);

lets do

fzf_result_t fzf_fuzzy_match_v1(bool case_sensitive, bool normalize,
                                const char *text, const char *pattern,
                                fzf_position_t *pos, fzf_slab_t *slab);

and if pos is NULL we dont add any. Otherwise we append the positions to the array. This should reduce the amount of malloc and realloc we need to call for more complex queries.

Also it should result in more streamlined code