To: vim_dev@googlegroups.com Subject: Patch 8.2.0653 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.0653 (after 8.2.0650) Problem: using uninitialized pointer. Solution: Move assignment up. (John Marriott) Files: src/userfunc.c, src/testdir/test_vim9_script.vim *** ../vim-8.2.0652/src/userfunc.c 2020-04-27 23:16:37.769746968 +0200 --- src/userfunc.c 2020-04-27 23:26:14.875682373 +0200 *************** *** 1599,1607 **** for (hi = func_hashtab.ht_array; todo > 0; ++hi) if (!HASHITEM_EMPTY(hi)) { if (STRNCMP(fp->uf_name, buf, len) == 0) { - fp = HI2UF(hi); fp->uf_flags |= FC_DEAD; func_clear(fp, TRUE); } --- 1599,1607 ---- for (hi = func_hashtab.ht_array; todo > 0; ++hi) if (!HASHITEM_EMPTY(hi)) { + fp = HI2UF(hi); if (STRNCMP(fp->uf_name, buf, len) == 0) { fp->uf_flags |= FC_DEAD; func_clear(fp, TRUE); } *** ../vim-8.2.0652/src/testdir/test_vim9_script.vim 2020-04-27 22:47:45.190176137 +0200 --- src/testdir/test_vim9_script.vim 2020-04-27 23:38:48.900966736 +0200 *************** *** 707,714 **** return valtwo enddef END ! writefile(lines + morelines, ! 'Xreload.vim') source Xreload.vim source Xreload.vim source Xreload.vim --- 707,713 ---- return valtwo enddef END ! writefile(lines + morelines, 'Xreload.vim') source Xreload.vim source Xreload.vim source Xreload.vim *************** *** 724,733 **** writefile(testlines, 'Ximport.vim') source Ximport.vim ! " test that when not using "morelines" valtwo is still defined ! " need to source Xreload.vim again, import doesn't reload a script writefile(lines, 'Xreload.vim') - source Xreload.vim source Ximport.vim " cannot declare a var twice --- 723,731 ---- writefile(testlines, 'Ximport.vim') source Ximport.vim ! " Test that when not using "morelines" GetValtwo() and valtwo are still ! " defined, because import doesn't reload a script. writefile(lines, 'Xreload.vim') source Ximport.vim " cannot declare a var twice *************** *** 750,785 **** return 'yes' enddef END ! let middle_lines =<< trim END def FuncNo(): string return 'no' enddef END ! let final_lines =<< trim END def g:DoCheck(no_exists: bool) assert_equal('yes', FuncYes()) ! if no_exists ! assert_equal('no', FuncNo()) ! else ! assert_fails('call FuncNo()', 'E117:') ! endif enddef END # FuncNo() is defined ! writefile(first_lines + middle_lines + final_lines, 'Xreloaded.vim') source Xreloaded.vim g:DoCheck(true) # FuncNo() is not redefined ! writefile(first_lines + final_lines, 'Xreloaded.vim') source Xreloaded.vim ! g:DoCheck(false) # FuncNo() is back ! writefile(first_lines + middle_lines + final_lines, 'Xreloaded.vim') source Xreloaded.vim ! g:DoCheck(true) delete('Xreloaded.vim') enddef --- 748,783 ---- return 'yes' enddef END ! let withno_lines =<< trim END def FuncNo(): string return 'no' enddef + def g:DoCheck(no_exists: bool) + assert_equal('yes', FuncYes()) + assert_equal('no', FuncNo()) + enddef END ! let nono_lines =<< trim END def g:DoCheck(no_exists: bool) assert_equal('yes', FuncYes()) ! assert_fails('call FuncNo()', 'E117:') enddef END # FuncNo() is defined ! writefile(first_lines + withno_lines, 'Xreloaded.vim') source Xreloaded.vim g:DoCheck(true) # FuncNo() is not redefined ! writefile(first_lines + nono_lines, 'Xreloaded.vim') source Xreloaded.vim ! g:DoCheck() # FuncNo() is back ! writefile(first_lines + withno_lines, 'Xreloaded.vim') source Xreloaded.vim ! g:DoCheck() delete('Xreloaded.vim') enddef *** ../vim-8.2.0652/src/version.c 2020-04-27 23:16:37.769746968 +0200 --- src/version.c 2020-04-27 23:27:14.647426982 +0200 *************** *** 748,749 **** --- 748,751 ---- { /* Add new patch number below this line */ + /**/ + 653, /**/ -- "Making it up? Why should I want to make anything up? Life's bad enough as it is without wanting to invent any more of it." -- Marvin, the Paranoid Android in 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/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///