Mirror of the Vim source from https://github.com/vim/vim
Revision | 9d74e2f433c0370cb458c83d12b05f72226df489 (tree) |
---|---|
Time | 2008-08-08 19:36:31 |
Author | vimboss |
Commiter | vimboss |
updated for version 7.2c-001
@@ -2681,7 +2681,11 @@ | ||
2681 | 2681 | Examples: > |
2682 | 2682 | :echo sort(extend(mylist, [7, 5])) |
2683 | 2683 | :call extend(mylist, [2, 3], 1) |
2684 | -< Use |add()| to concatenate one item to a list. To concatenate | |
2684 | +< When {expr1} is the same List as {expr2} then the number of | |
2685 | + items copied is equal to the original length of the List. | |
2686 | + E.g., when {expr3} is 1 you get N new copies of the first item | |
2687 | + (where N is the original length of the List). | |
2688 | + Use |add()| to concatenate one item to a list. To concatenate | |
2685 | 2689 | two lists into a new list use the + operator: > |
2686 | 2690 | :let newlist = [1, 2, 3] + [4, 5] |
2687 | 2691 | < |
@@ -6231,8 +6231,11 @@ | ||
6231 | 6231 | listitem_T *bef; |
6232 | 6232 | { |
6233 | 6233 | listitem_T *item; |
6234 | - | |
6235 | - for (item = l2->lv_first; item != NULL; item = item->li_next) | |
6234 | + int todo = l2->lv_len; | |
6235 | + | |
6236 | + /* We also quit the loop when we have inserted the original item count of | |
6237 | + * the list, avoid a hang when we extend a list with itself. */ | |
6238 | + for (item = l2->lv_first; item != NULL && --todo >= 0; item = item->li_next) | |
6236 | 6239 | if (list_insert_tv(l1, &item->li_tv, bef) == FAIL) |
6237 | 6240 | return FAIL; |
6238 | 6241 | return OK; |
@@ -677,6 +677,8 @@ | ||
677 | 677 | static int included_patches[] = |
678 | 678 | { /* Add new patch number below this line */ |
679 | 679 | /**/ |
680 | + 1, | |
681 | +/**/ | |
680 | 682 | 0 |
681 | 683 | }; |
682 | 684 |