forked from aniani/vim
patch 8.1.1974: Coverity warns for using pointer as array
Problem: Coverity warns for using pointer as array. Solution: Call var2fpos() directly instead of using f_line().
This commit is contained in:
@@ -1152,20 +1152,16 @@ non_zero_arg(typval_T *argvars)
|
||||
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() */
|
||||
if (lnum == 0) // no valid number, try using arg like 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;
|
||||
int fnum;
|
||||
pos_T *fp = var2fpos(&argvars[0], TRUE, &fnum);
|
||||
|
||||
if (fp != NULL)
|
||||
lnum = fp->lnum;
|
||||
}
|
||||
return lnum;
|
||||
}
|
||||
|
@@ -761,6 +761,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
1974,
|
||||
/**/
|
||||
1973,
|
||||
/**/
|
||||
|
Reference in New Issue
Block a user