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