To: vim_dev@googlegroups.com Subject: Patch 8.2.0375 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.0375 Problem: Coverity warning for not using return value. Solution: Move error message to separate function. Files: src/popupwin.c *** ../vim-8.2.0374/src/popupwin.c 2020-03-11 14:19:53.480369957 +0100 --- src/popupwin.c 2020-03-13 14:33:51.397599047 +0100 *************** *** 2492,2497 **** --- 2492,2522 ---- 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,2515 **** { if (wp == curwin) { ! ERROR_IF_ANY_POPUP_WINDOW; return; } if (prev == NULL) --- 2534,2540 ---- { if (wp == curwin) { ! error_for_popup_window(); return; } if (prev == NULL) *************** *** 2540,2546 **** { if (wp == curwin) { ! ERROR_IF_ANY_POPUP_WINDOW; return; } if (prev == NULL) --- 2565,2571 ---- { if (wp == curwin) { ! error_for_popup_window(); return; } if (prev == NULL) *************** *** 2888,2912 **** } } - 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. --- 2913,2918 ---- *** ../vim-8.2.0374/src/version.c 2020-03-12 19:15:36.212964855 +0100 --- src/version.c 2020-03-13 14:34:07.553507846 +0100 *************** *** 740,741 **** --- 740,743 ---- { /* Add new patch number below this line */ + /**/ + 375, /**/ -- "Marriage is when a man and woman become as one; the trouble starts when they try to decide which one" /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///