forked from aniani/vim
		
	patch 8.2.0539: comparing two NULL list fails
Problem: Comparing two NULL list fails. Solution: Change the order of comparing two lists.
This commit is contained in:
		| @@ -368,12 +368,15 @@ list_equal( | |||||||
| { | { | ||||||
|     listitem_T	*item1, *item2; |     listitem_T	*item1, *item2; | ||||||
|  |  | ||||||
|     if (l1 == NULL || l2 == NULL) |  | ||||||
| 	return FALSE; |  | ||||||
|     if (l1 == l2) |     if (l1 == l2) | ||||||
| 	return TRUE; | 	return TRUE; | ||||||
|     if (list_len(l1) != list_len(l2)) |     if (list_len(l1) != list_len(l2)) | ||||||
| 	return FALSE; | 	return FALSE; | ||||||
|  |     if (list_len(l1) == 0) | ||||||
|  | 	// empty and NULL list are considered equal | ||||||
|  | 	return TRUE; | ||||||
|  |     if (l1 == NULL || l2 == NULL) | ||||||
|  | 	return FALSE; | ||||||
|  |  | ||||||
|     range_list_materialize(l1); |     range_list_materialize(l1); | ||||||
|     range_list_materialize(l2); |     range_list_materialize(l2); | ||||||
|   | |||||||
| @@ -36,6 +36,9 @@ func Test_assert_equal() | |||||||
|   call assert_equal(0, assert_equal(4, n)) |   call assert_equal(0, assert_equal(4, n)) | ||||||
|   let l = [1, 2, 3] |   let l = [1, 2, 3] | ||||||
|   call assert_equal(0, assert_equal([1, 2, 3], l)) |   call assert_equal(0, assert_equal([1, 2, 3], l)) | ||||||
|  |   call assert_equal(test_null_list(), test_null_list()) | ||||||
|  |   call assert_equal(test_null_list(), []) | ||||||
|  |   call assert_equal([], test_null_list()) | ||||||
|  |  | ||||||
|   let s = 'foo' |   let s = 'foo' | ||||||
|   call assert_equal(1, assert_equal('bar', s)) |   call assert_equal(1, assert_equal('bar', s)) | ||||||
|   | |||||||
| @@ -738,6 +738,8 @@ static char *(features[]) = | |||||||
|  |  | ||||||
| static int included_patches[] = | static int included_patches[] = | ||||||
| {   /* Add new patch number below this line */ | {   /* Add new patch number below this line */ | ||||||
|  | /**/ | ||||||
|  |     539, | ||||||
| /**/ | /**/ | ||||||
|     538, |     538, | ||||||
| /**/ | /**/ | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user