diff options
author | ZyX <kp-pav@yandex.ru> | 2017-04-01 22:26:50 +0300 |
---|---|---|
committer | ZyX <kp-pav@yandex.ru> | 2017-04-01 22:26:50 +0300 |
commit | 19690d4a25f15dfa752ac3723384f1d33f06329a (patch) | |
tree | fbf848c468cb7374539e5dbc71eceafd100b8681 | |
parent | cc4523013f8e693f92de3b96ff36065895c60974 (diff) | |
download | rneovim-19690d4a25f15dfa752ac3723384f1d33f06329a.tar.gz rneovim-19690d4a25f15dfa752ac3723384f1d33f06329a.tar.bz2 rneovim-19690d4a25f15dfa752ac3723384f1d33f06329a.zip |
eval: Do not allocate FileDescriptor
-rw-r--r-- | src/nvim/eval.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c index a6774a3a0b..f0d78a2508 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -17439,21 +17439,21 @@ static void f_writefile(typval_T *argvars, typval_T *rettv, FunPtr fptr) if (fname == NULL) { return; } - FileDescriptor *fp; + FileDescriptor fp; int error; rettv->vval.v_number = -1; if (*fname == NUL) { EMSG(_("E482: Can't open file with an empty name")); - } else if ((fp = file_open_new(&error, fname, - ((append ? kFileAppend : kFileTruncate) - | kFileCreate), 0666)) == NULL) { + } else if ((error = file_open(&fp, fname, + ((append ? kFileAppend : kFileTruncate) + | kFileCreate), 0666)) != 0) { emsgf(_("E482: Can't open file %s for writing: %s"), fname, os_strerror(error)); } else { - if (write_list(fp, argvars[0].vval.v_list, binary)) { + if (write_list(&fp, argvars[0].vval.v_list, binary)) { rettv->vval.v_number = 0; } - if ((error = file_free(fp)) != 0) { + if ((error = file_close(&fp)) != 0) { emsgf(_("E80: Error when closing file %s: %s"), fname, os_strerror(error)); } |