Patch 8.2.4629
Problem: flattennew() makes a deep copy unnecessarily.
Solution: Use a shallow copy. (issue #10012)
Files: src/list.c
*** ../vim-8.2.4628/src/list.c 2022-03-25 19:50:53.877135393 +0000
--- src/list.c 2022-03-26 10:29:13.375688883 +0000
***************
*** 925,931 ****
list_flatten(list_T *list, listitem_T *first, long maxitems, long maxdepth)
{
listitem_T *item;
- listitem_T *tofree;
int done = 0;
if (maxdepth == 0)
--- 925,930 ----
***************
*** 955,967 ****
return;
}
clear_tv(&item->li_tv);
- tofree = item;
if (maxdepth > 0)
list_flatten(list, item->li_prev == NULL
? list->lv_first : item->li_prev->li_next,
itemlist->lv_len, maxdepth - 1);
! list_free_item(list, tofree);
}
++done;
--- 954,965 ----
return;
}
clear_tv(&item->li_tv);
if (maxdepth > 0)
list_flatten(list, item->li_prev == NULL
? list->lv_first : item->li_prev->li_next,
itemlist->lv_len, maxdepth - 1);
! list_free_item(list, item);
}
++done;
***************
*** 1012,1018 ****
if (make_copy)
{
! l = list_copy(l, TRUE, TRUE, get_copyID());
rettv->vval.v_list = l;
if (l == NULL)
return;
--- 1010,1016 ----
if (make_copy)
{
! l = list_copy(l, FALSE, TRUE, get_copyID());
rettv->vval.v_list = l;
if (l == NULL)
return;
*** ../vim-8.2.4628/src/version.c 2022-03-25 21:19:22.115496681 +0000
--- src/version.c 2022-03-26 10:48:58.762554937 +0000
***************
*** 752,753 ****
--- 752,755 ----
{ /* Add new patch number below this line */
+ /**/
+ 4629,
/**/
--
Individualists unite!
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/20220326105051.B67C21C0C1F%40moolenaar.net.