diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2018-05-17 09:14:54 +0200 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2018-05-17 09:14:54 +0200 |
commit | e121b1dbe78cdf7ad46f493ca3a1cb83c190f719 (patch) | |
tree | 9b38b0944d078da2b0fa30f2bfe70d6c5233e89b /src/nvim/memline.c | |
parent | 2aa308c6852b7c51caef5dd6dc4e809719ca7a55 (diff) | |
parent | d2944e6a298e824e5084ac0dfd8701ff9cd1a523 (diff) | |
download | rneovim-e121b1dbe78cdf7ad46f493ca3a1cb83c190f719.tar.gz rneovim-e121b1dbe78cdf7ad46f493ca3a1cb83c190f719.tar.bz2 rneovim-e121b1dbe78cdf7ad46f493ca3a1cb83c190f719.zip |
Merge #8331 'handle various errors'
closes #8331
Diffstat (limited to 'src/nvim/memline.c')
-rw-r--r-- | src/nvim/memline.c | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/src/nvim/memline.c b/src/nvim/memline.c index 06de9fda67..3b0cac0456 100644 --- a/src/nvim/memline.c +++ b/src/nvim/memline.c @@ -246,7 +246,6 @@ typedef enum { */ int ml_open(buf_T *buf) { - memfile_T *mfp; bhdr_T *hp = NULL; ZERO_BL *b0p; PTR_BL *pp; @@ -275,12 +274,8 @@ int ml_open(buf_T *buf) buf->b_may_swap = false; } - /* - * Open the memfile. No swap file is created yet. - */ - mfp = mf_open(NULL, 0); - if (mfp == NULL) - goto error; + // Open the memfile. No swap file is created yet. + memfile_T *mfp = mf_open(NULL, 0); buf->b_ml.ml_mfp = mfp; buf->b_ml.ml_flags = ML_EMPTY; @@ -364,11 +359,10 @@ int ml_open(buf_T *buf) return OK; error: - if (mfp != NULL) { - if (hp) - mf_put(mfp, hp, false, false); - mf_close(mfp, true); /* will also xfree(mfp->mf_fname) */ + if (hp) { + mf_put(mfp, hp, false, false); } + mf_close(mfp, true); // will also xfree(mfp->mf_fname) buf->b_ml.ml_mfp = NULL; return FAIL; } @@ -842,7 +836,7 @@ void ml_recover(void) mf_open() will consume "fname_used"! */ mfp = mf_open(fname_used, O_RDONLY); fname_used = p; - if (mfp == NULL || mfp->mf_fd < 0) { + if (mfp->mf_fd < 0) { EMSG2(_("E306: Cannot open %s"), fname_used); goto theend; } |