From 3141c02c0201c02a438d5148717b93a50d702c25 Mon Sep 17 00:00:00 2001 From: Will Stamper Date: Tue, 17 Jun 2014 21:47:42 -0500 Subject: coverity/68215: removed failed variable + dead code from f_readfile #860 --- src/nvim/eval.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) (limited to 'src') 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); } -- cgit