aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames McCoy <jamessan@jamessan.com>2016-11-15 16:53:07 -0500
committerJames McCoy <jamessan@jamessan.com>2016-12-28 14:57:39 -0500
commit03ed7e1ebaf7f0934b176c71949a77a3fe2291fb (patch)
tree2765f93413fb968cdb697b290ee645fc64f759f8
parentc4c894b2fada371c424e55d26174110b9069b5f8 (diff)
downloadrneovim-03ed7e1ebaf7f0934b176c71949a77a3fe2291fb.tar.gz
rneovim-03ed7e1ebaf7f0934b176c71949a77a3fe2291fb.tar.bz2
rneovim-03ed7e1ebaf7f0934b176c71949a77a3fe2291fb.zip
vim-patch:7.4.2272
Problem: getbufinfo(), getwininfo() and gettabinfo() are inefficient. Solution: Instead of making a copy of the variables dictionary, use a reference. https://github.com/vim/vim/commit/9f8187c335b4fb07be9095dfdd0fc52670ba3c3f
-rw-r--r--src/nvim/eval.c21
-rw-r--r--src/nvim/version.c2
2 files changed, 7 insertions, 16 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c
index 6dee5ed336..59d1132c79 100644
--- a/src/nvim/eval.c
+++ b/src/nvim/eval.c
@@ -9880,11 +9880,8 @@ static dict_T *get_buffer_info(buf_T *buf)
buf->b_ml.ml_mfp != NULL && buf->b_nwindows == 0,
NULL);
- // Copy buffer variables
- dict_T *vars = dict_copy(NULL, buf->b_vars, true, 0);
- if (vars != NULL) {
- dict_add_dict(dict, "variables", vars);
- }
+ // Get a reference to buffer variables
+ dict_add_dict(dict, "variables", buf->b_vars);
// Copy buffer options
dict_T *opts = get_winbuf_options(true);
@@ -10806,11 +10803,8 @@ static dict_T *get_tabpage_info(tabpage_T *tp, int tp_idx)
}
dict_add_list(dict, "windows", l);
- // Copy tabpage variables
- dict_T *vars = dict_copy(NULL, tp->tp_vars, true, 0);
- if (vars != NULL) {
- dict_add_dict(dict, "variables", vars);
- }
+ // Make a reference to tabpage variables
+ dict_add_dict(dict, "variables", tp->tp_vars);
return dict;
}
@@ -10910,11 +10904,8 @@ static dict_T *get_win_info(win_T *wp, short tpnr, short winnr)
(bt_quickfix(wp->w_buffer) && wp->w_llist_ref != NULL),
NULL);
- // Copy window variables
- dict_T *vars = dict_copy(NULL, wp->w_vars, true, 0);
- if (vars != NULL) {
- dict_add_dict(dict, "variables", vars);
- }
+ // Make a reference to window variables
+ dict_add_dict(dict, "variables", wp->w_vars);
// Copy window options
dict_T *opts = get_winbuf_options(false);
diff --git a/src/nvim/version.c b/src/nvim/version.c
index 21fa7253ba..4ad4c82928 100644
--- a/src/nvim/version.c
+++ b/src/nvim/version.c
@@ -168,7 +168,7 @@ static int included_patches[] = {
// 2275,
2274,
// 2273,
- // 2272,
+ 2272,
// 2271 NA
// 2270 NA
// 2269,