diff options
author | Marco Hinz <mh.codebro@gmail.com> | 2017-01-09 14:35:04 +0100 |
---|---|---|
committer | James McCoy <jamessan@jamessan.com> | 2017-02-04 17:55:46 -0500 |
commit | c05e7f0fdd15d550cfb1054416a08d4514a4fb7e (patch) | |
tree | ac051f64de7006efe1463da9e549e7c507817683 /src/nvim/spell.c | |
parent | e3b92c77da0277c8d58e037e42c5b929be469284 (diff) | |
download | rneovim-c05e7f0fdd15d550cfb1054416a08d4514a4fb7e.tar.gz rneovim-c05e7f0fdd15d550cfb1054416a08d4514a4fb7e.tar.bz2 rneovim-c05e7f0fdd15d550cfb1054416a08d4514a4fb7e.zip |
vim-patch:7.4.2024
Problem: More buf_valid() calls can be optimized.
Solution: Use bufref_valid() instead.
NOTE: Some changes related to channels and the Python and Netbeans interfaces
were obviously left out.
https://github.com/vim/vim/commit/7c0a2f367f2507669560b1a66423155c70d2e75b
Diffstat (limited to 'src/nvim/spell.c')
-rw-r--r-- | src/nvim/spell.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/nvim/spell.c b/src/nvim/spell.c index 7e0bbd6ad1..1ace39344d 100644 --- a/src/nvim/spell.c +++ b/src/nvim/spell.c @@ -3746,6 +3746,9 @@ char_u *did_set_spelllang(win_T *wp) char_u *ret_msg = NULL; char_u *spl_copy; + bufref_T bufref; + set_bufref(&bufref, wp->w_buffer); + // We don't want to do this recursively. May happen when a language is // not available and the SpellFileMissing autocommand opens a new buffer // in which 'spell' is set. @@ -3824,7 +3827,7 @@ char_u *did_set_spelllang(win_T *wp) spell_load_lang(lang); // SpellFileMissing autocommands may do anything, including // destroying the buffer we are using... - if (!buf_valid(wp->w_buffer)) { + if (!bufref_valid(&bufref)) { ret_msg = (char_u *)"E797: SpellFileMissing autocommand deleted buffer"; goto theend; @@ -13037,8 +13040,9 @@ void ex_spelldump(exarg_T *eap) set_option_value((char_u*)"spl", dummy, spl, OPT_LOCAL); xfree(spl); - if (!bufempty() || !buf_valid(curbuf)) + if (!bufempty()) { return; + } spell_dump_compl(NULL, 0, NULL, eap->forceit ? DUMPFLAG_COUNT : 0); |