Review of the memfile.c API and small refactorings

- Create `mf_free_fnames()` that frees and nullifies `mf_[f]fname`
- Create `mf_set_fnames()` to set the `mf_fname` and the `mf_ffname`
  altoghether
- Have `mf_do_open` return a bool to indicate success so that calles
	don't have to check `memfile_T::mf_fd` (file descriptor)
- Inline `mf_write_block`
This commit is contained in:
Felipe Oliveira Carvalho
2016-03-04 23:00:52 -03:00
parent c94575fded
commit 3e85aee48c
2 changed files with 73 additions and 77 deletions

View File

@@ -426,10 +426,8 @@ void ml_setname(buf_T *buf)
/* try to rename the swap file */
if (vim_rename(mfp->mf_fname, fname) == 0) {
success = TRUE;
xfree(mfp->mf_fname);
mfp->mf_fname = fname;
xfree(mfp->mf_ffname);
mf_set_ffname(mfp);
mf_free_fnames(mfp);
mf_set_fnames(mfp, fname);
ml_upd_block0(buf, UB_SAME_DIR);
break;
}