summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/testdir/test_functions.vim3
-rw-r--r--src/version.c6
2 files changed, 8 insertions, 1 deletions
diff --git a/src/testdir/test_functions.vim b/src/testdir/test_functions.vim
index f55e846fa..38cd7930a 100644
--- a/src/testdir/test_functions.vim
+++ b/src/testdir/test_functions.vim
@@ -40,6 +40,9 @@ func Test_has()
" Will we ever have patch 9999?
let ver = 'patch-' .. v:version / 100 .. '.' .. v:version % 100 .. '.9999'
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
func Test_empty()
diff --git a/src/version.c b/src/version.c
index 003984ab6..c2726aa77 100644
--- a/src/version.c
+++ b/src/version.c
@@ -736,6 +736,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 10,
+/**/
9,
/**/
8,
@@ -789,11 +791,13 @@ has_patch(int n)
// Perform a binary search.
l = 0;
h = (int)ARRAY_LENGTH(included_patches) - 1;
- while (l < h)
+ for (;;)
{
m = (l + h) / 2;
if (included_patches[m] == n)
return TRUE;
+ if (l == h)
+ break;
if (included_patches[m] < n)
h = m;
else