From 3dffc842fec3365d70192cc7c8162412d9187f9d Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Tue, 28 Aug 2018 15:38:59 -0400 Subject: [PATCH 1/3] vim-patch:8.0.0983: unnecessary check for NULL pointer Problem: Unnecessary check for NULL pointer. Solution: Remove the NULL check in dialog_changed(), it already happens in dialog_msg(). (Ken Takata) https://github.com/vim/vim/commit/3f9a1ff141412e9e85f7dff47d02946cb9be9228 --- src/nvim/ex_cmds2.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/nvim/ex_cmds2.c b/src/nvim/ex_cmds2.c index ab24b63110..c920264791 100644 --- a/src/nvim/ex_cmds2.c +++ b/src/nvim/ex_cmds2.c @@ -1285,9 +1285,8 @@ void dialog_changed(buf_T *buf, int checkall) int ret; exarg_T ea; - dialog_msg(buff, _("Save changes to \"%s\"?"), - (buf->b_fname != NULL) ? - buf->b_fname : (char_u *)_("Untitled")); + assert(buf->b_fname != NULL); + dialog_msg(buff, _("Save changes to \"%s\"?"), buf->b_fname); if (checkall) { ret = vim_dialog_yesnoallcancel(VIM_QUESTION, NULL, buff, 1); } else { From 60f1acd0eff217d0e466115765575077782e5767 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Tue, 28 Aug 2018 16:01:16 -0400 Subject: [PATCH 2/3] ex_cmds2: checkall in dialog_changed() is bool --- src/nvim/ex_cmds2.c | 2 +- src/nvim/window.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/nvim/ex_cmds2.c b/src/nvim/ex_cmds2.c index c920264791..f7da5b6c97 100644 --- a/src/nvim/ex_cmds2.c +++ b/src/nvim/ex_cmds2.c @@ -1279,7 +1279,7 @@ bool check_changed(buf_T *buf, int flags) /// /// @param buf /// @param checkall may abandon all changed buffers -void dialog_changed(buf_T *buf, int checkall) +void dialog_changed(buf_T *buf, bool checkall) { char_u buff[DIALOG_MSG_SIZE]; int ret; diff --git a/src/nvim/window.c b/src/nvim/window.c index 3f66568b58..569b366c00 100644 --- a/src/nvim/window.c +++ b/src/nvim/window.c @@ -2882,7 +2882,7 @@ close_others ( } if (!r) { if (message && (p_confirm || cmdmod.confirm) && p_write) { - dialog_changed(wp->w_buffer, FALSE); + dialog_changed(wp->w_buffer, false); if (!win_valid(wp)) { /* autocommands messed wp up */ nextwp = firstwin; continue; From 29961794821f4c71e891a9ac4db186018ffbb8c5 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Tue, 28 Aug 2018 16:09:26 -0400 Subject: [PATCH 3/3] lint --- src/nvim/window.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/nvim/window.c b/src/nvim/window.c index 569b366c00..d9bed0789d 100644 --- a/src/nvim/window.c +++ b/src/nvim/window.c @@ -2883,7 +2883,7 @@ close_others ( if (!r) { if (message && (p_confirm || cmdmod.confirm) && p_write) { dialog_changed(wp->w_buffer, false); - if (!win_valid(wp)) { /* autocommands messed wp up */ + if (!win_valid(wp)) { // autocommands messed wp up nextwp = firstwin; continue; }