Mercurial > vim
comparison src/eval.c @ 1008:58059676e24a v7.0.134
updated for version 7.0-134
author | vimboss |
---|---|
date | Sun, 15 Oct 2006 13:09:12 +0000 |
parents | f49d72bf9c5c |
children | 721ebb602db0 |
comparison
equal
deleted
inserted
replaced
1007:7d29124f77f5 | 1008:58059676e24a |
---|---|
5518 typval_T *tv2; | 5518 typval_T *tv2; |
5519 int ic; /* ignore case */ | 5519 int ic; /* ignore case */ |
5520 { | 5520 { |
5521 char_u buf1[NUMBUFLEN], buf2[NUMBUFLEN]; | 5521 char_u buf1[NUMBUFLEN], buf2[NUMBUFLEN]; |
5522 char_u *s1, *s2; | 5522 char_u *s1, *s2; |
5523 | 5523 static int recursive = 0; /* cach recursive loops */ |
5524 if (tv1->v_type != tv2->v_type) | 5524 int r; |
5525 | |
5526 /* Catch lists and dicts that have an endless loop by limiting | |
5527 * recursiveness to 1000. */ | |
5528 if (tv1->v_type != tv2->v_type || recursive >= 1000) | |
5525 return FALSE; | 5529 return FALSE; |
5526 | 5530 |
5527 switch (tv1->v_type) | 5531 switch (tv1->v_type) |
5528 { | 5532 { |
5529 case VAR_LIST: | 5533 case VAR_LIST: |
5530 /* recursive! */ | 5534 ++recursive; |
5531 return list_equal(tv1->vval.v_list, tv2->vval.v_list, ic); | 5535 r = list_equal(tv1->vval.v_list, tv2->vval.v_list, ic); |
5536 --recursive; | |
5537 return r; | |
5532 | 5538 |
5533 case VAR_DICT: | 5539 case VAR_DICT: |
5534 /* recursive! */ | 5540 ++recursive; |
5535 return dict_equal(tv1->vval.v_dict, tv2->vval.v_dict, ic); | 5541 r = dict_equal(tv1->vval.v_dict, tv2->vval.v_dict, ic); |
5542 --recursive; | |
5543 return r; | |
5536 | 5544 |
5537 case VAR_FUNC: | 5545 case VAR_FUNC: |
5538 return (tv1->vval.v_string != NULL | 5546 return (tv1->vval.v_string != NULL |
5539 && tv2->vval.v_string != NULL | 5547 && tv2->vval.v_string != NULL |
5540 && STRCMP(tv1->vval.v_string, tv2->vval.v_string) == 0); | 5548 && STRCMP(tv1->vval.v_string, tv2->vval.v_string) == 0); |