Karsten Hopp 1476a9
To: vim_dev@googlegroups.com
Karsten Hopp 1476a9
Subject: Patch 7.4.419
Karsten Hopp 1476a9
Fcc: outbox
Karsten Hopp 1476a9
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp 1476a9
Mime-Version: 1.0
Karsten Hopp 1476a9
Content-Type: text/plain; charset=UTF-8
Karsten Hopp 1476a9
Content-Transfer-Encoding: 8bit
Karsten Hopp 1476a9
------------
Karsten Hopp 1476a9
Karsten Hopp 1476a9
Patch 7.4.419
Karsten Hopp 1476a9
Problem:    When part of a list is locked it's possible to make changes.
Karsten Hopp 1476a9
Solution:   Check if any of the list items is locked before make a change.
Karsten Hopp 1476a9
	    (ZyX)
Karsten Hopp 1476a9
Files:	    src/eval.c, src/testdir/test55.in, src/testdir/test55.ok
Karsten Hopp 1476a9
Karsten Hopp 1476a9
Karsten Hopp 1476a9
*** ../vim-7.4.418/src/eval.c	2014-08-22 13:13:24.219895762 +0200
Karsten Hopp 1476a9
--- src/eval.c	2014-08-29 09:37:56.930403905 +0200
Karsten Hopp 1476a9
***************
Karsten Hopp 1476a9
*** 2945,2950 ****
Karsten Hopp 1476a9
--- 2945,2967 ----
Karsten Hopp 1476a9
  	;
Karsten Hopp 1476a9
      else if (lp->ll_range)
Karsten Hopp 1476a9
      {
Karsten Hopp 1476a9
+ 	listitem_T *ll_li = lp->ll_li;
Karsten Hopp 1476a9
+ 	int ll_n1 = lp->ll_n1;
Karsten Hopp 1476a9
+ 
Karsten Hopp 1476a9
+ 	/*
Karsten Hopp 1476a9
+ 	 * Check whether any of the list items is locked
Karsten Hopp 1476a9
+ 	 */
Karsten Hopp 1476a9
+ 	for (ri = rettv->vval.v_list->lv_first; ri != NULL; )
Karsten Hopp 1476a9
+ 	{
Karsten Hopp 1476a9
+ 	    if (tv_check_lock(ll_li->li_tv.v_lock, lp->ll_name))
Karsten Hopp 1476a9
+ 		return;
Karsten Hopp 1476a9
+ 	    ri = ri->li_next;
Karsten Hopp 1476a9
+ 	    if (ri == NULL || (!lp->ll_empty2 && lp->ll_n2 == ll_n1))
Karsten Hopp 1476a9
+ 		break;
Karsten Hopp 1476a9
+ 	    ll_li = ll_li->li_next;
Karsten Hopp 1476a9
+ 	    ++ll_n1;
Karsten Hopp 1476a9
+ 	}
Karsten Hopp 1476a9
+ 
Karsten Hopp 1476a9
  	/*
Karsten Hopp 1476a9
  	 * Assign the List values to the list items.
Karsten Hopp 1476a9
  	 */
Karsten Hopp 1476a9
***************
Karsten Hopp 1476a9
*** 3646,3651 ****
Karsten Hopp 1476a9
--- 3663,3679 ----
Karsten Hopp 1476a9
      else if (lp->ll_range)
Karsten Hopp 1476a9
      {
Karsten Hopp 1476a9
  	listitem_T    *li;
Karsten Hopp 1476a9
+ 	listitem_T    *ll_li = lp->ll_li;
Karsten Hopp 1476a9
+ 	int           ll_n1 = lp->ll_n1;
Karsten Hopp 1476a9
+ 
Karsten Hopp 1476a9
+ 	while (ll_li != NULL && (lp->ll_empty2 || lp->ll_n2 >= ll_n1))
Karsten Hopp 1476a9
+ 	{
Karsten Hopp 1476a9
+ 	    li = ll_li->li_next;
Karsten Hopp 1476a9
+ 	    if (tv_check_lock(ll_li->li_tv.v_lock, lp->ll_name))
Karsten Hopp 1476a9
+ 		return FAIL;
Karsten Hopp 1476a9
+ 	    ll_li = li;
Karsten Hopp 1476a9
+ 	    ++ll_n1;
Karsten Hopp 1476a9
+ 	}
Karsten Hopp 1476a9
  
Karsten Hopp 1476a9
  	/* Delete a range of List items. */
Karsten Hopp 1476a9
  	while (lp->ll_li != NULL && (lp->ll_empty2 || lp->ll_n2 >= lp->ll_n1))
Karsten Hopp 1476a9
*** ../vim-7.4.418/src/testdir/test55.in	2014-07-02 19:06:14.686326091 +0200
Karsten Hopp 1476a9
--- src/testdir/test55.in	2014-08-29 09:37:23.474403832 +0200
Karsten Hopp 1476a9
***************
Karsten Hopp 1476a9
*** 282,287 ****
Karsten Hopp 1476a9
--- 282,302 ----
Karsten Hopp 1476a9
  :    $put =ps
Karsten Hopp 1476a9
  :  endfor
Karsten Hopp 1476a9
  :endfor
Karsten Hopp 1476a9
+ :unlet l
Karsten Hopp 1476a9
+ :let l = [1, 2, 3, 4]
Karsten Hopp 1476a9
+ :lockvar! l
Karsten Hopp 1476a9
+ :$put =string(l)
Karsten Hopp 1476a9
+ :unlockvar l[1]
Karsten Hopp 1476a9
+ :unlet l[0:1]
Karsten Hopp 1476a9
+ :$put =string(l)
Karsten Hopp 1476a9
+ :unlet l[1:2]
Karsten Hopp 1476a9
+ :$put =string(l)
Karsten Hopp 1476a9
+ :unlockvar l[1]
Karsten Hopp 1476a9
+ :let l[0:1] = [0, 1]
Karsten Hopp 1476a9
+ :$put =string(l)
Karsten Hopp 1476a9
+ :let l[1:2] = [0, 1]
Karsten Hopp 1476a9
+ :$put =string(l)
Karsten Hopp 1476a9
+ :unlet l
Karsten Hopp 1476a9
  :" :lockvar/islocked() triggering script autoloading
Karsten Hopp 1476a9
  :set rtp+=./sautest
Karsten Hopp 1476a9
  :lockvar g:footest#x
Karsten Hopp 1476a9
*** ../vim-7.4.418/src/testdir/test55.ok	2014-07-02 19:06:14.686326091 +0200
Karsten Hopp 1476a9
--- src/testdir/test55.ok	2014-08-29 09:37:29.606403846 +0200
Karsten Hopp 1476a9
***************
Karsten Hopp 1476a9
*** 86,91 ****
Karsten Hopp 1476a9
--- 86,96 ----
Karsten Hopp 1476a9
  FFpFFpp
Karsten Hopp 1476a9
  0000-000
Karsten Hopp 1476a9
  ppppppp
Karsten Hopp 1476a9
+ [1, 2, 3, 4]
Karsten Hopp 1476a9
+ [1, 2, 3, 4]
Karsten Hopp 1476a9
+ [1, 2, 3, 4]
Karsten Hopp 1476a9
+ [1, 2, 3, 4]
Karsten Hopp 1476a9
+ [1, 2, 3, 4]
Karsten Hopp 1476a9
  locked g:footest#x:-1
Karsten Hopp 1476a9
  exists g:footest#x:0
Karsten Hopp 1476a9
  g:footest#x: 1
Karsten Hopp 1476a9
*** ../vim-7.4.418/src/version.c	2014-08-29 09:02:23.890399246 +0200
Karsten Hopp 1476a9
--- src/version.c	2014-08-29 09:39:24.658404097 +0200
Karsten Hopp 1476a9
***************
Karsten Hopp 1476a9
*** 743,744 ****
Karsten Hopp 1476a9
--- 743,746 ----
Karsten Hopp 1476a9
  {   /* Add new patch number below this line */
Karsten Hopp 1476a9
+ /**/
Karsten Hopp 1476a9
+     419,
Karsten Hopp 1476a9
  /**/
Karsten Hopp 1476a9
Karsten Hopp 1476a9
-- 
Karsten Hopp 1476a9
hundred-and-one symptoms of being an internet addict:
Karsten Hopp 1476a9
90. Instead of calling you to dinner, your spouse sends e-mail.
Karsten Hopp 1476a9
Karsten Hopp 1476a9
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp 1476a9
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp 1476a9
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp 1476a9
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///