To: vim_dev@googlegroups.com Subject: Patch 9.0.0010 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 9.0.0010 Problem: Returning 0 for has('patch-9.0.0') is inconsistent. Solution: Make it return 1. (closes #10640) Files: src/version.c, src/testdir/test_functions.vim *** ../vim-9.0.0009/src/version.c 2022-06-29 21:16:53.641158372 +0100 --- src/version.c 2022-06-30 10:59:46.304839619 +0100 *************** *** 789,799 **** // Perform a binary search. l = 0; h = (int)ARRAY_LENGTH(included_patches) - 1; ! while (l < h) { m = (l + h) / 2; if (included_patches[m] == n) return TRUE; if (included_patches[m] < n) h = m; else --- 791,803 ---- // Perform a binary search. l = 0; h = (int)ARRAY_LENGTH(included_patches) - 1; ! for (;;) { m = (l + h) / 2; if (included_patches[m] == n) return TRUE; + if (l == h) + break; if (included_patches[m] < n) h = m; else *** ../vim-9.0.0009/src/testdir/test_functions.vim 2022-06-05 18:55:39.000000000 +0100 --- src/testdir/test_functions.vim 2022-06-30 10:52:13.525272644 +0100 *************** *** 40,45 **** --- 40,48 ---- " 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() *** ../vim-9.0.0009/src/version.c 2022-06-29 21:16:53.641158372 +0100 --- src/version.c 2022-06-30 10:59:46.304839619 +0100 *************** *** 737,738 **** --- 737,740 ---- { /* Add new patch number below this line */ + /**/ + 10, /**/ -- Now it is such a bizarrely improbable coincidence that anything as mind-bogglingly useful as the Babel fish could have evolved purely by chance that some thinkers have chosen to see it as a final and clinching proof of the NON-existence of God. The argument goes something like this: 'I refuse to prove that I exist,' says God, 'for proof denies faith, and without faith I am nothing.' 'But,' says Man, 'the Babel fish is a dead giveaway, isn't it? It could not have evolved by chance. It proves you exist, and so therefore, by your own arguments, you don't. QED.' 'Oh dear,' says God, 'I hadn't thought of that,' and promptly vanishes in a puff of logic. 'Oh, that was easy,' says Man, and for an encore goes on to prove that black is white and gets himself killed on the next pedestrian crossing. -- Douglas Adams, "The Hitchhiker's Guide to the Galaxy" /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///