To: vim_dev@googlegroups.com Subject: Patch 8.1.1974 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.1.1974 Problem: Coverity warns for using pointer as array. Solution: Call var2fpos() directly instead of using f_line(). Files: src/evalfunc.c *** ../vim-8.1.1973/src/evalfunc.c 2019-09-02 22:56:20.992583887 +0200 --- src/evalfunc.c 2019-09-04 13:20:36.530452179 +0200 *************** *** 1152,1171 **** linenr_T tv_get_lnum(typval_T *argvars) { - typval_T rettv; linenr_T lnum; - int save_type; lnum = (linenr_T)tv_get_number_chk(&argvars[0], NULL); ! if (lnum == 0) /* no valid number, try using line() */ { ! rettv.v_type = VAR_NUMBER; ! save_type = argvars[1].v_type; ! argvars[1].v_type = VAR_UNKNOWN; ! f_line(argvars, &rettv); ! lnum = (linenr_T)rettv.vval.v_number; ! clear_tv(&rettv); ! argvars[1].v_type = save_type; } return lnum; } --- 1152,1167 ---- linenr_T tv_get_lnum(typval_T *argvars) { linenr_T lnum; lnum = (linenr_T)tv_get_number_chk(&argvars[0], NULL); ! if (lnum == 0) // no valid number, try using arg like line() { ! int fnum; ! pos_T *fp = var2fpos(&argvars[0], TRUE, &fnum); ! ! if (fp != NULL) ! lnum = fp->lnum; } return lnum; } *** ../vim-8.1.1973/src/version.c 2019-09-04 11:51:14.281537844 +0200 --- src/version.c 2019-09-04 13:15:25.823821397 +0200 *************** *** 763,764 **** --- 763,766 ---- { /* Add new patch number below this line */ + /**/ + 1974, /**/ -- If Microsoft would build a car... ... Occasionally your car would die on the freeway for no reason. You would have to pull over to the side of the road, close all of the car windows, shut it off, restart it, and reopen the windows before you could continue. For some reason you would simply accept this. /// 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 ///