mirror of
https://github.com/vim/vim.git
synced 2025-10-13 06:54:15 -04:00
patch 7.4.2272
Problem: getbufinfo(), getwininfo() and gettabinfo() are inefficient. Solution: Instead of making a copy of the variables dictionary, use a reference.
This commit is contained in:
@@ -3922,7 +3922,6 @@ get_buffer_info(buf_T *buf)
|
|||||||
{
|
{
|
||||||
dict_T *dict;
|
dict_T *dict;
|
||||||
dict_T *opts;
|
dict_T *opts;
|
||||||
dict_T *vars;
|
|
||||||
tabpage_T *tp;
|
tabpage_T *tp;
|
||||||
win_T *wp;
|
win_T *wp;
|
||||||
list_T *windows;
|
list_T *windows;
|
||||||
@@ -3943,10 +3942,8 @@ get_buffer_info(buf_T *buf)
|
|||||||
buf->b_ml.ml_mfp != NULL && buf->b_nwindows == 0,
|
buf->b_ml.ml_mfp != NULL && buf->b_nwindows == 0,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
/* Copy buffer variables */
|
/* Get a reference to buffer variables */
|
||||||
vars = dict_copy(buf->b_vars, TRUE, 0);
|
dict_add_dict(dict, "variables", buf->b_vars);
|
||||||
if (vars != NULL)
|
|
||||||
dict_add_dict(dict, "variables", vars);
|
|
||||||
|
|
||||||
/* Copy buffer options */
|
/* Copy buffer options */
|
||||||
opts = get_winbuf_options(TRUE);
|
opts = get_winbuf_options(TRUE);
|
||||||
@@ -4994,7 +4991,6 @@ get_tabpage_info(tabpage_T *tp, int tp_idx)
|
|||||||
{
|
{
|
||||||
win_T *wp;
|
win_T *wp;
|
||||||
dict_T *dict;
|
dict_T *dict;
|
||||||
dict_T *vars;
|
|
||||||
list_T *l;
|
list_T *l;
|
||||||
|
|
||||||
dict = dict_alloc();
|
dict = dict_alloc();
|
||||||
@@ -5012,10 +5008,8 @@ get_tabpage_info(tabpage_T *tp, int tp_idx)
|
|||||||
dict_add_list(dict, "windows", l);
|
dict_add_list(dict, "windows", l);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Copy tabpage variables */
|
/* Make a reference to tabpage variables */
|
||||||
vars = dict_copy(tp->tp_vars, TRUE, 0);
|
dict_add_dict(dict, "variables", tp->tp_vars);
|
||||||
if (vars != NULL)
|
|
||||||
dict_add_dict(dict, "variables", vars);
|
|
||||||
|
|
||||||
return dict;
|
return dict;
|
||||||
}
|
}
|
||||||
@@ -5118,7 +5112,6 @@ f_gettabwinvar(typval_T *argvars, typval_T *rettv)
|
|||||||
get_win_info(win_T *wp, short tpnr, short winnr)
|
get_win_info(win_T *wp, short tpnr, short winnr)
|
||||||
{
|
{
|
||||||
dict_T *dict;
|
dict_T *dict;
|
||||||
dict_T *vars;
|
|
||||||
dict_T *opts;
|
dict_T *opts;
|
||||||
|
|
||||||
dict = dict_alloc();
|
dict = dict_alloc();
|
||||||
@@ -5138,10 +5131,8 @@ get_win_info(win_T *wp, short tpnr, short winnr)
|
|||||||
(bt_quickfix(wp->w_buffer) && wp->w_llist_ref != NULL), NULL);
|
(bt_quickfix(wp->w_buffer) && wp->w_llist_ref != NULL), NULL);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Copy window variables */
|
/* Make a reference to window variables */
|
||||||
vars = dict_copy(wp->w_vars, TRUE, 0);
|
dict_add_dict(dict, "variables", wp->w_vars);
|
||||||
if (vars != NULL)
|
|
||||||
dict_add_dict(dict, "variables", vars);
|
|
||||||
|
|
||||||
/* Copy window options */
|
/* Copy window options */
|
||||||
opts = get_winbuf_options(FALSE);
|
opts = get_winbuf_options(FALSE);
|
||||||
|
@@ -763,6 +763,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
2272,
|
||||||
/**/
|
/**/
|
||||||
2271,
|
2271,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user