To: vim_dev@googlegroups.com Subject: Patch 7.4.2272 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 7.4.2272 Problem: getbufinfo(), getwininfo() and gettabinfo() are inefficient. Solution: Instead of making a copy of the variables dictionary, use a reference. Files: src/evalfunc.c *** ../vim-7.4.2271/src/evalfunc.c 2016-08-25 23:19:25.667805265 +0200 --- src/evalfunc.c 2016-08-27 20:24:39.381342536 +0200 *************** *** 3922,3928 **** { dict_T *dict; dict_T *opts; - dict_T *vars; tabpage_T *tp; win_T *wp; list_T *windows; --- 3922,3927 ---- *************** *** 3943,3952 **** buf->b_ml.ml_mfp != NULL && buf->b_nwindows == 0, NULL); ! /* Copy buffer variables */ ! vars = dict_copy(buf->b_vars, TRUE, 0); ! if (vars != NULL) ! dict_add_dict(dict, "variables", vars); /* Copy buffer options */ opts = get_winbuf_options(TRUE); --- 3942,3949 ---- buf->b_ml.ml_mfp != NULL && buf->b_nwindows == 0, NULL); ! /* Get a reference to buffer variables */ ! dict_add_dict(dict, "variables", buf->b_vars); /* Copy buffer options */ opts = get_winbuf_options(TRUE); *************** *** 4994,5000 **** { win_T *wp; dict_T *dict; - dict_T *vars; list_T *l; dict = dict_alloc(); --- 4991,4996 ---- *************** *** 5012,5021 **** dict_add_list(dict, "windows", l); } ! /* Copy tabpage variables */ ! vars = dict_copy(tp->tp_vars, TRUE, 0); ! if (vars != NULL) ! dict_add_dict(dict, "variables", vars); return dict; } --- 5008,5015 ---- dict_add_list(dict, "windows", l); } ! /* Make a reference to tabpage variables */ ! dict_add_dict(dict, "variables", tp->tp_vars); return dict; } *************** *** 5118,5124 **** get_win_info(win_T *wp, short tpnr, short winnr) { dict_T *dict; - dict_T *vars; dict_T *opts; dict = dict_alloc(); --- 5112,5117 ---- *************** *** 5138,5147 **** (bt_quickfix(wp->w_buffer) && wp->w_llist_ref != NULL), NULL); #endif ! /* Copy window variables */ ! vars = dict_copy(wp->w_vars, TRUE, 0); ! if (vars != NULL) ! dict_add_dict(dict, "variables", vars); /* Copy window options */ opts = get_winbuf_options(FALSE); --- 5131,5138 ---- (bt_quickfix(wp->w_buffer) && wp->w_llist_ref != NULL), NULL); #endif ! /* Make a reference to window variables */ ! dict_add_dict(dict, "variables", wp->w_vars); /* Copy window options */ opts = get_winbuf_options(FALSE); *** ../vim-7.4.2271/src/version.c 2016-08-27 19:52:43.069912717 +0200 --- src/version.c 2016-08-27 20:24:15.089548886 +0200 *************** *** 765,766 **** --- 765,768 ---- { /* Add new patch number below this line */ + /**/ + 2272, /**/ -- From "know your smileys": 8-O "Omigod!!" (done "rm -rf *" ?) /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///