diff options
author | KunMing Xie <qqzz014@gmail.com> | 2018-06-10 18:31:51 +0800 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2018-06-10 12:31:51 +0200 |
commit | 7cc9d2b2b2e2cc4e78bf37512ac03ded3e18d6c1 (patch) | |
tree | 1c0e9383b3c201c12f3d7bcdb7d0b5c6d95bb570 /src/nvim/regexp.c | |
parent | bbb88607c9cc60a6fa332382e9a8cc0c8726c03f (diff) | |
download | rneovim-7cc9d2b2b2e2cc4e78bf37512ac03ded3e18d6c1.tar.gz rneovim-7cc9d2b2b2e2cc4e78bf37512ac03ded3e18d6c1.tar.bz2 rneovim-7cc9d2b2b2e2cc4e78bf37512ac03ded3e18d6c1.zip |
vim-patch:8.0.0520: using a function pointer while the function is known (#8513)
Problem: Using a function pointer instead of the actual function, which we
know.
Solution: Change mb_ functions to utf_ functions when already checked for
Unicode. (Dominique Pelle, closes vim/vim#1582)
https://github.com/vim/vim/commit/ace95989ed81929a84e205b26d0972cb9d6b4b19
Diffstat (limited to 'src/nvim/regexp.c')
-rw-r--r-- | src/nvim/regexp.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/nvim/regexp.c b/src/nvim/regexp.c index c4af7d9e4a..ef02b6529c 100644 --- a/src/nvim/regexp.c +++ b/src/nvim/regexp.c @@ -4246,26 +4246,28 @@ regmatch ( int opndc = 0, inpc; opnd = OPERAND(scan); - /* Safety check (just in case 'encoding' was changed since - * compiling the program). */ + // Safety check (just in case 'encoding' was changed since + // compiling the program). if ((len = (*mb_ptr2len)(opnd)) < 2) { status = RA_NOMATCH; break; } - if (enc_utf8) - opndc = mb_ptr2char(opnd); + if (enc_utf8) { + opndc = utf_ptr2char(opnd); + } if (enc_utf8 && utf_iscomposing(opndc)) { /* When only a composing char is given match at any * position where that composing char appears. */ status = RA_NOMATCH; for (i = 0; reginput[i] != NUL; i += utf_ptr2len(reginput + i)) { - inpc = mb_ptr2char(reginput + i); + inpc = utf_ptr2char(reginput + i); if (!utf_iscomposing(inpc)) { - if (i > 0) + if (i > 0) { break; + } } else if (opndc == inpc) { - /* Include all following composing chars. */ - len = i + mb_ptr2len(reginput + i); + // Include all following composing chars. + len = i + utfc_ptr2len(reginput + i); status = RA_MATCH; break; } |