lkundrak / rpms / vim

Forked from rpms/vim 4 years ago
Clone
e6ac2e8
To: vim-dev@vim.org
e6ac2e8
Subject: Patch 7.0.140
e6ac2e8
Fcc: outbox
e6ac2e8
From: Bram Moolenaar <Bram@moolenaar.net>
e6ac2e8
Mime-Version: 1.0
e6ac2e8
Content-Type: text/plain; charset=ISO-8859-1
e6ac2e8
Content-Transfer-Encoding: 8bit
e6ac2e8
------------
e6ac2e8
e6ac2e8
Patch 7.0.140 (after 7.0.134)
e6ac2e8
Problem:    Comparing recursively looped List or Dictionary doesn't work well.
e6ac2e8
Solution:   Detect comparing a List or Dictionary with itself.
e6ac2e8
Files:	    src/eval.c
e6ac2e8
e6ac2e8
e6ac2e8
*** ../vim-7.0.139/src/eval.c	Sun Oct 15 22:38:41 2006
e6ac2e8
--- src/eval.c	Sun Oct 15 22:30:09 2006
e6ac2e8
***************
e6ac2e8
*** 5451,5456 ****
e6ac2e8
--- 5451,5458 ----
e6ac2e8
  {
e6ac2e8
      listitem_T	*item1, *item2;
e6ac2e8
  
e6ac2e8
+     if (l1 == l2)
e6ac2e8
+ 	return TRUE;
e6ac2e8
      if (list_len(l1) != list_len(l2))
e6ac2e8
  	return FALSE;
e6ac2e8
  
e6ac2e8
***************
e6ac2e8
*** 5487,5492 ****
e6ac2e8
--- 5489,5496 ----
e6ac2e8
      dictitem_T	*item2;
e6ac2e8
      int		todo;
e6ac2e8
  
e6ac2e8
+     if (d1 == d2)
e6ac2e8
+ 	return TRUE;
e6ac2e8
      if (dict_len(d1) != dict_len(d2))
e6ac2e8
  	return FALSE;
e6ac2e8
  
e6ac2e8
***************
e6ac2e8
*** 5522,5531 ****
e6ac2e8
      static int  recursive = 0;	    /* cach recursive loops */
e6ac2e8
      int		r;
e6ac2e8
  
e6ac2e8
!     /* Catch lists and dicts that have an endless loop by limiting
e6ac2e8
!      * recursiveness to 1000. */
e6ac2e8
!     if (tv1->v_type != tv2->v_type || recursive >= 1000)
e6ac2e8
  	return FALSE;
e6ac2e8
  
e6ac2e8
      switch (tv1->v_type)
e6ac2e8
      {
e6ac2e8
--- 5526,5537 ----
e6ac2e8
      static int  recursive = 0;	    /* cach recursive loops */
e6ac2e8
      int		r;
e6ac2e8
  
e6ac2e8
!     if (tv1->v_type != tv2->v_type)
e6ac2e8
  	return FALSE;
e6ac2e8
+     /* Catch lists and dicts that have an endless loop by limiting
e6ac2e8
+      * recursiveness to 1000.  We guess they are equal then. */
e6ac2e8
+     if (recursive >= 1000)
e6ac2e8
+ 	return TRUE;
e6ac2e8
  
e6ac2e8
      switch (tv1->v_type)
e6ac2e8
      {
e6ac2e8
*** ../vim-7.0.139/src/version.c	Tue Oct 17 13:39:36 2006
e6ac2e8
--- src/version.c	Tue Oct 17 15:15:04 2006
e6ac2e8
***************
e6ac2e8
*** 668,669 ****
e6ac2e8
--- 668,671 ----
e6ac2e8
  {   /* Add new patch number below this line */
e6ac2e8
+ /**/
e6ac2e8
+     140,
e6ac2e8
  /**/
e6ac2e8
e6ac2e8
-- 
e6ac2e8
hundred-and-one symptoms of being an internet addict:
e6ac2e8
54. You start tilting your head sideways to smile. :-)
e6ac2e8
e6ac2e8
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
e6ac2e8
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
e6ac2e8
\\\        download, build and distribute -- http://www.A-A-P.org        ///
e6ac2e8
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///