]> granicus.if.org Git - vim/commitdiff
updated for version 7.2c-001 v7.2c.001
authorBram Moolenaar <Bram@vim.org>
Fri, 8 Aug 2008 10:36:31 +0000 (10:36 +0000)
committerBram Moolenaar <Bram@vim.org>
Fri, 8 Aug 2008 10:36:31 +0000 (10:36 +0000)
runtime/doc/eval.txt
src/eval.c
src/version.c

index ffe5ea9e56adb9e271ada68cac1b82308ae13982..8bb990a05e0ede78e14f185f27ad181edd932d85 100644 (file)
@@ -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]
 <
index cb548d30dc8f52d43859955759276b35dd63802d..5802a0894049012e0dc0db23bd470e363e0edc5e 100644 (file)
@@ -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;
index 21d7b143c23093b535b98a4bac438adc1a0eac2f..c8565c447a9f2989015e6f0fdeb5b2cb4720f744 100644 (file)
@@ -676,6 +676,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1,
 /**/
     0
 };