aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorWill Stamper <epmatsw@gmail.com>2014-06-17 21:47:42 -0500
committerJustin M. Keyes <justinkz@gmail.com>2014-06-18 23:57:05 -0400
commit3141c02c0201c02a438d5148717b93a50d702c25 (patch)
treeafa38de83fbfaa923344d07d222a0ca0c69986cd /src
parentec72b7adc7d573de8ed9f03d327dc523ccc0cc42 (diff)
downloadrneovim-3141c02c0201c02a438d5148717b93a50d702c25.tar.gz
rneovim-3141c02c0201c02a438d5148717b93a50d702c25.tar.bz2
rneovim-3141c02c0201c02a438d5148717b93a50d702c25.zip
coverity/68215: removed failed variable + dead code from f_readfile #860
Diffstat (limited to 'src')
-rw-r--r--src/nvim/eval.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c
index d2f3f3e2f1..c8042695d2 100644
--- a/src/nvim/eval.c
+++ b/src/nvim/eval.c
@@ -11469,7 +11469,6 @@ static void f_range(typval_T *argvars, typval_T *rettv)
static void f_readfile(typval_T *argvars, typval_T *rettv)
{
int binary = FALSE;
- int failed = FALSE;
char_u *fname;
FILE *fd;
char_u buf[(IOSIZE/256)*256]; /* rounded to avoid odd + 1 */
@@ -11586,7 +11585,7 @@ static void f_readfile(typval_T *argvars, typval_T *rettv)
}
} /* for */
- if (failed || (cnt >= maxline && maxline >= 0) || readlen <= 0)
+ if ((cnt >= maxline && maxline >= 0) || readlen <= 0)
break;
if (start < p) {
/* There's part of a line in buf, store it in "prev". */
@@ -11615,18 +11614,12 @@ static void f_readfile(typval_T *argvars, typval_T *rettv)
* For a negative line count use only the lines at the end of the file,
* free the rest.
*/
- if (!failed && maxline < 0)
+ if (maxline < 0)
while (cnt > -maxline) {
listitem_remove(rettv->vval.v_list, rettv->vval.v_list->lv_first);
--cnt;
}
- if (failed) {
- list_free(rettv->vval.v_list, TRUE);
- /* readfile doc says an empty list is returned on error */
- rettv->vval.v_list = list_alloc();
- }
-
free(prev);
fclose(fd);
}