To: vim_dev@googlegroups.com Subject: Patch 8.0.1410 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.0.1410 Problem: Hang when using count() with an empty string. Solution: Return zero for an empty string. (Dominique Pelle, closes #2465) Files: runtime/doc/eval.txt, src/evalfunc.c, src/testdir/test_functions.vim *** ../vim-8.0.1409/runtime/doc/eval.txt 2017-12-18 19:48:34.805669514 +0100 --- runtime/doc/eval.txt 2017-12-19 11:48:01.113651466 +0100 *************** *** 3327,3334 **** When {ic} is given and it's |TRUE| then case is ignored. When {comp} is a string then the number of not overlapping ! occurences of {expr} is returned. ! *cscope_connection()* cscope_connection([{num} , {dbpath} [, {prepend}]]) --- 3338,3345 ---- When {ic} is given and it's |TRUE| then case is ignored. When {comp} is a string then the number of not overlapping ! occurrences of {expr} is returned. Zero is returned when ! {expr} is an empty string. *cscope_connection()* cscope_connection([{num} , {dbpath} [, {prepend}]]) *** ../vim-8.0.1409/src/evalfunc.c 2017-12-10 21:06:17.739851817 +0100 --- src/evalfunc.c 2017-12-19 11:45:36.582609979 +0100 *************** *** 2382,2388 **** char_u *p = argvars[0].vval.v_string; char_u *next; ! if (!error && expr != NULL && p != NULL) { if (ic) { --- 2382,2388 ---- char_u *p = argvars[0].vval.v_string; char_u *next; ! if (!error && expr != NULL && *expr != NUL && p != NULL) { if (ic) { *** ../vim-8.0.1409/src/testdir/test_functions.vim 2017-11-18 20:31:57.535138233 +0100 --- src/testdir/test_functions.vim 2017-12-19 11:45:36.582609979 +0100 *************** *** 692,697 **** --- 692,698 ---- call assert_equal(0, count("foo", "O")) call assert_equal(2, count("foo", "O", 1)) call assert_equal(2, count("fooooo", "oo")) + call assert_equal(0, count("foo", "")) endfunc func Test_changenr() *** ../vim-8.0.1409/src/version.c 2017-12-19 10:49:30.828391001 +0100 --- src/version.c 2017-12-19 11:47:16.501946986 +0100 *************** *** 773,774 **** --- 773,776 ---- { /* Add new patch number below this line */ + /**/ + 1410, /**/ -- hundred-and-one symptoms of being an internet addict: 128. You can access the Net -- via your portable and cellular phone. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///