summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-03-13 14:34:38 +0100
committerBram Moolenaar <Bram@vim.org>2020-03-13 14:34:38 +0100
commit8210693795d6d0d51bf5b70674d4539cdde0330b (patch)
treeb6bd16ee87617b2754f8c3dfd24d127e0733d676
parent8a677a37d03692db274c8b00cb20dbba9604505e (diff)
downloadvim-git-8210693795d6d0d51bf5b70674d4539cdde0330b.tar.gz
patch 8.2.0375: Coverity warning for not using return valuev8.2.0375
Problem: Coverity warning for not using return value. Solution: Move error message to separate function.
-rw-r--r--src/popupwin.c48
-rw-r--r--src/version.c2
2 files changed, 29 insertions, 21 deletions
diff --git a/src/popupwin.c b/src/popupwin.c
index 1b56c1c4b..8e981b0be 100644
--- a/src/popupwin.c
+++ b/src/popupwin.c
@@ -2492,6 +2492,31 @@ popup_free(win_T *wp)
popup_mask_refresh = TRUE;
}
+ static void
+error_for_popup_window(void)
+{
+ emsg(_("E994: Not allowed in a popup window"));
+}
+
+ int
+error_if_popup_window(int also_with_term UNUSED)
+{
+ // win_execute() may set "curwin" to a popup window temporarily, but many
+ // commands are disallowed then. When a terminal runs in the popup most
+ // things are allowed. When a terminal is finished it can be closed.
+ if (WIN_IS_POPUP(curwin)
+# ifdef FEAT_TERMINAL
+ && (also_with_term || curbuf->b_term == NULL)
+ && !term_is_finished(curbuf)
+# endif
+ )
+ {
+ error_for_popup_window();
+ return TRUE;
+ }
+ return FALSE;
+}
+
/*
* Close a popup window by Window-id.
* Does not invoke the callback.
@@ -2509,7 +2534,7 @@ popup_close(int id)
{
if (wp == curwin)
{
- ERROR_IF_ANY_POPUP_WINDOW;
+ error_for_popup_window();
return;
}
if (prev == NULL)
@@ -2540,7 +2565,7 @@ popup_close_tabpage(tabpage_T *tp, int id)
{
if (wp == curwin)
{
- ERROR_IF_ANY_POPUP_WINDOW;
+ error_for_popup_window();
return;
}
if (prev == NULL)
@@ -2888,25 +2913,6 @@ f_popup_getoptions(typval_T *argvars, typval_T *rettv)
}
}
- int
-error_if_popup_window(int also_with_term UNUSED)
-{
- // win_execute() may set "curwin" to a popup window temporarily, but many
- // commands are disallowed then. When a terminal runs in the popup most
- // things are allowed. When a terminal is finished it can be closed.
- if (WIN_IS_POPUP(curwin)
-# ifdef FEAT_TERMINAL
- && (also_with_term || curbuf->b_term == NULL)
- && !term_is_finished(curbuf)
-# endif
- )
- {
- emsg(_("E994: Not allowed in a popup window"));
- return TRUE;
- }
- return FALSE;
-}
-
# if defined(FEAT_TERMINAL) || defined(PROTO)
/*
* Return TRUE if the current window is running a terminal in a popup window.
diff --git a/src/version.c b/src/version.c
index 6f1b9e793..2e720adce 100644
--- a/src/version.c
+++ b/src/version.c
@@ -739,6 +739,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 375,
+/**/
374,
/**/
373,