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 -- [email protected] -- 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 ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/201909041121.x84BLtRu024717%40masaka.moolenaar.net.