From efa924f66b183d9cf2404ce91c4f009c27e0515a Mon Sep 17 00:00:00 2001 From: James McCoy Date: Mon, 18 Oct 2021 09:08:46 -0400 Subject: vim-patch:8.1.0743: giving error messages is not flexible Problem: Giving error messages is not flexible. Solution: Add semsg(). Change argument from "char_u *" to "char *", also for msg() and get rid of most MSG macros. (Ozaki Kiichi, closes vim/vim#3302) Also make emsg() accept a "char *" argument. Get rid of an enormous number of type casts. https://github.com/vim/vim/commit/f9e3e09fdc93be9f0d47afbc6c7df1188c2a5a0d --- src/nvim/memfile.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/nvim/memfile.c') diff --git a/src/nvim/memfile.c b/src/nvim/memfile.c index 438340e0c4..2a0ea9a269 100644 --- a/src/nvim/memfile.c +++ b/src/nvim/memfile.c @@ -168,7 +168,7 @@ void mf_close(memfile_T *mfp, bool del_file) return; } if (mfp->mf_fd >= 0 && close(mfp->mf_fd) < 0) { - EMSG(_(e_swapclose)); + emsg(_(e_swapclose)); } if (del_file && mfp->mf_fname != NULL) { os_remove((char *)mfp->mf_fname); @@ -206,7 +206,7 @@ void mf_close_file(buf_T *buf, bool getlines) } if (close(mfp->mf_fd) < 0) { // close the file - EMSG(_(e_swapclose)); + emsg(_(e_swapclose)); } mfp->mf_fd = -1; @@ -325,7 +325,7 @@ void mf_put(memfile_T *mfp, bhdr_T *hp, bool dirty, bool infile) unsigned flags = hp->bh_flags; if ((flags & BH_LOCKED) == 0) { - IEMSG(_("E293: block was not locked")); + iemsg(_("E293: block was not locked")); } flags &= ~BH_LOCKED; if (dirty) { @@ -648,7 +648,7 @@ static int mf_write(memfile_T *mfp, bhdr_T *hp) /// write or when hitting a key. We keep on trying, in case some /// space becomes available. if (!did_swapwrite_msg) { - EMSG(_("E297: Write error in swap file")); + emsg(_("E297: Write error in swap file")); } did_swapwrite_msg = true; return FAIL; @@ -792,7 +792,7 @@ static bool mf_do_open(memfile_T *mfp, char_u *fname, int flags) if ((flags & O_CREAT) && os_fileinfo_link((char *)mfp->mf_fname, &file_info)) { mfp->mf_fd = -1; - EMSG(_("E300: Swap file already exists (symlink attack?)")); + emsg(_("E300: Swap file already exists (symlink attack?)")); } else { // try to open the file mfp->mf_fd = mch_open_rw((char *)mfp->mf_fname, flags | O_NOFOLLOW); -- cgit