forked from aniani/vim
patch 9.0.0010: returning 0 for has('patch-9.0.0') is inconsistent
Problem: Returning 0 for has('patch-9.0.0') is inconsistent. Solution: Make it return 1. (closes #10640)
This commit is contained in:
@@ -40,6 +40,9 @@ func Test_has()
|
|||||||
" Will we ever have patch 9999?
|
" Will we ever have patch 9999?
|
||||||
let ver = 'patch-' .. v:version / 100 .. '.' .. v:version % 100 .. '.9999'
|
let ver = 'patch-' .. v:version / 100 .. '.' .. v:version % 100 .. '.9999'
|
||||||
call assert_equal(0, has(ver))
|
call assert_equal(0, has(ver))
|
||||||
|
|
||||||
|
" There actually isn't a patch 9.0.0, but this is more consistent.
|
||||||
|
call assert_equal(1, has('patch-9.0.0'))
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_empty()
|
func Test_empty()
|
||||||
|
@@ -735,6 +735,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 */
|
||||||
|
/**/
|
||||||
|
10,
|
||||||
/**/
|
/**/
|
||||||
9,
|
9,
|
||||||
/**/
|
/**/
|
||||||
@@ -789,11 +791,13 @@ has_patch(int n)
|
|||||||
// Perform a binary search.
|
// Perform a binary search.
|
||||||
l = 0;
|
l = 0;
|
||||||
h = (int)ARRAY_LENGTH(included_patches) - 1;
|
h = (int)ARRAY_LENGTH(included_patches) - 1;
|
||||||
while (l < h)
|
for (;;)
|
||||||
{
|
{
|
||||||
m = (l + h) / 2;
|
m = (l + h) / 2;
|
||||||
if (included_patches[m] == n)
|
if (included_patches[m] == n)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
if (l == h)
|
||||||
|
break;
|
||||||
if (included_patches[m] < n)
|
if (included_patches[m] < n)
|
||||||
h = m;
|
h = m;
|
||||||
else
|
else
|
||||||
|
Reference in New Issue
Block a user