diff options
author | Bram Moolenaar <Bram@vim.org> | 2016-07-10 22:11:16 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2016-07-10 22:11:16 +0200 |
commit | 7c0a2f367f2507669560b1a66423155c70d2e75b (patch) | |
tree | 7cd0523311a25f653497197abc1fa86ed62bcc79 /src/spell.c | |
parent | ea3f2e7be447a8f0c4436869620f908de5e8ef1e (diff) | |
download | vim-git-7c0a2f367f2507669560b1a66423155c70d2e75b.tar.gz |
patch 7.4.2024v7.4.2024
Problem: More buf_valid() calls can be optimized.
Solution: Use bufref_valid() instead.
Diffstat (limited to 'src/spell.c')
-rw-r--r-- | src/spell.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/spell.c b/src/spell.c index 610c7b820..af9689107 100644 --- a/src/spell.c +++ b/src/spell.c @@ -4178,6 +4178,11 @@ did_set_spelllang(win_T *wp) static int recursive = FALSE; char_u *ret_msg = NULL; char_u *spl_copy; +#ifdef FEAT_AUTOCMD + bufref_T bufref; + + set_bufref(&bufref, wp->w_buffer); +#endif /* We don't want to do this recursively. May happen when a language is * not available and the SpellFileMissing autocommand opens a new buffer @@ -4278,7 +4283,7 @@ did_set_spelllang(win_T *wp) #ifdef FEAT_AUTOCMD /* 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; @@ -15561,7 +15566,7 @@ ex_spelldump(exarg_T *eap) set_option_value((char_u*)"spl", dummy, spl, OPT_LOCAL); vim_free(spl); - if (!bufempty() || !buf_valid(curbuf)) + if (!bufempty()) return; spell_dump_compl(NULL, 0, NULL, eap->forceit ? DUMPFLAG_COUNT : 0); |