aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/ex_cmds.c
diff options
context:
space:
mode:
authorMarco Hinz <mh.codebro@gmail.com>2017-01-09 14:35:04 +0100
committerJames McCoy <jamessan@jamessan.com>2017-02-04 17:55:46 -0500
commitc05e7f0fdd15d550cfb1054416a08d4514a4fb7e (patch)
treeac051f64de7006efe1463da9e549e7c507817683 /src/nvim/ex_cmds.c
parente3b92c77da0277c8d58e037e42c5b929be469284 (diff)
downloadrneovim-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/ex_cmds.c')
-rw-r--r--src/nvim/ex_cmds.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c
index 163df5dc05..3b7f3b7b97 100644
--- a/src/nvim/ex_cmds.c
+++ b/src/nvim/ex_cmds.c
@@ -2086,7 +2086,7 @@ int do_ecmd(
int did_set_swapcommand = FALSE;
buf_T *buf;
bufref_T bufref;
- buf_T *old_curbuf = curbuf;
+ bufref_T old_curbuf;
char_u *free_fname = NULL;
int retval = FAIL;
long n;
@@ -2103,6 +2103,8 @@ int do_ecmd(
if (eap != NULL)
command = eap->do_ecmd_cmd;
+ set_bufref(&old_curbuf, curbuf);
+
if (fnum != 0) {
if (fnum == curbuf->b_fnum) /* file is already being edited */
return OK; /* nothing to do */
@@ -2214,7 +2216,7 @@ int do_ecmd(
if (oldwin != NULL) {
oldwin = curwin;
}
- old_curbuf = curbuf;
+ set_bufref(&old_curbuf, curbuf);
}
if (buf == NULL)
goto theend;
@@ -2228,7 +2230,7 @@ int do_ecmd(
(void)buf_check_timestamp(buf, false);
// Check if autocommands made buffer invalid or changed the current
// buffer.
- if (!bufref_valid(&bufref) || curbuf != old_curbuf) {
+ if (!bufref_valid(&bufref) || curbuf != old_curbuf.br_buf) {
goto theend;
}
if (aborting()) {
@@ -2283,7 +2285,7 @@ int do_ecmd(
// Set the w_closing flag to avoid that autocommands close the window.
the_curwin->w_closing = true;
- if (curbuf == old_curbuf) {
+ if (curbuf == old_curbuf.br_buf) {
buf_copy_options(buf, BCO_ENTER);
}
@@ -2487,7 +2489,7 @@ int do_ecmd(
if (swap_exists_action == SEA_QUIT)
retval = FAIL;
- handle_swap_exists(old_curbuf);
+ handle_swap_exists(&old_curbuf);
} else {
/* Read the modelines, but only to set window-local options. Any
* buffer-local options have already been set and may have been