[SCM] Vim packaging branch, upstream, updated. upstream/7.2c.000-4-g8d10f9c
James Vega
jamessan at debian.org
Sun Aug 10 01:35:27 UTC 2008
The following commit has been merged in the upstream branch:
commit edabf3db46df1d5014f9173da2d4eee813e86a1f
Author: Bram Moolenaar <Bram at moolenaar.net>
Date: Sat Aug 9 21:19:33 2008 -0400
[7.2c.001]
Patch 7.2c.001
Problem: ":let x=[''] | let x += x" causes hang. (Matt Wozniski)
Solution: Only insert elements up to the original length of the List.
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt
index ffe5ea9..8bb990a 100644
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -2681,7 +2681,11 @@ extend({expr1}, {expr2} [, {expr3}]) *extend()*
Examples: >
:echo sort(extend(mylist, [7, 5]))
:call extend(mylist, [2, 3], 1)
-< Use |add()| to concatenate one item to a list. To concatenate
+< When {expr1} is the same List as {expr2} then the number of
+ items copied is equal to the original length of the List.
+ E.g., when {expr3} is 1 you get N new copies of the first item
+ (where N is the original length of the List).
+ Use |add()| to concatenate one item to a list. To concatenate
two lists into a new list use the + operator: >
:let newlist = [1, 2, 3] + [4, 5]
<
diff --git a/src/eval.c b/src/eval.c
index cb548d3..5802a08 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -6231,8 +6231,11 @@ list_extend(l1, l2, bef)
listitem_T *bef;
{
listitem_T *item;
+ int todo = l2->lv_len;
- for (item = l2->lv_first; item != NULL; item = item->li_next)
+ /* We also quit the loop when we have inserted the original item count of
+ * the list, avoid a hang when we extend a list with itself. */
+ for (item = l2->lv_first; item != NULL && --todo >= 0; item = item->li_next)
if (list_insert_tv(l1, &item->li_tv, bef) == FAIL)
return FAIL;
return OK;
diff --git a/src/version.c b/src/version.c
index 21d7b14..c8565c4 100644
--- a/src/version.c
+++ b/src/version.c
@@ -677,6 +677,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1,
+/**/
0
};
--
Vim packaging
More information about the pkg-vim-maintainers
mailing list