mirror of
https://github.com/neovim/neovim.git
synced 2025-09-06 03:18:16 +00:00
vim-patch:9.0.1246: code is indented more than necessary (#22006)
Problem: Code is indented more than necessary.
Solution: Use an early return where it makes sense. (Yegappan Lakshmanan,
closes vim/vim#11887)
142ed77898
Omit function_using_block_scopes(): only affects Vim9 script.
Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
This commit is contained in:
@@ -760,13 +760,12 @@ static void funccal_unref(funccall_T *fc, ufunc_T *fp, bool force)
|
||||
static bool func_remove(ufunc_T *fp)
|
||||
{
|
||||
hashitem_T *hi = hash_find(&func_hashtab, (char *)UF2HIKEY(fp));
|
||||
|
||||
if (!HASHITEM_EMPTY(hi)) {
|
||||
hash_remove(&func_hashtab, hi);
|
||||
return true;
|
||||
if (HASHITEM_EMPTY(hi)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
hash_remove(&func_hashtab, hi);
|
||||
return true;
|
||||
}
|
||||
|
||||
static void func_clear_items(ufunc_T *fp)
|
||||
|
@@ -2985,11 +2985,13 @@ void u_saveline(linenr_T lnum)
|
||||
/// (this is used externally for crossing a line while in insert mode)
|
||||
void u_clearline(void)
|
||||
{
|
||||
if (curbuf->b_u_line_ptr != NULL) {
|
||||
if (curbuf->b_u_line_ptr == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
XFREE_CLEAR(curbuf->b_u_line_ptr);
|
||||
curbuf->b_u_line_lnum = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/// Implementation of the "U" command.
|
||||
/// Differentiation from vi: "U" can be undone with the next "U".
|
||||
|
@@ -2599,6 +2599,7 @@ static bool close_last_window_tabpage(win_T *win, bool free_buf, tabpage_T *prev
|
||||
if (!ONE_WINDOW) {
|
||||
return false;
|
||||
}
|
||||
|
||||
buf_T *old_curbuf = curbuf;
|
||||
|
||||
Terminal *term = win->w_buffer ? win->w_buffer->terminal : NULL;
|
||||
@@ -4144,13 +4145,14 @@ int may_open_tabpage(void)
|
||||
{
|
||||
int n = (cmdmod.cmod_tab == 0) ? postponed_split_tab : cmdmod.cmod_tab;
|
||||
|
||||
if (n != 0) {
|
||||
if (n == 0) {
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
cmdmod.cmod_tab = 0; // reset it to avoid doing it twice
|
||||
postponed_split_tab = 0;
|
||||
return win_new_tabpage(n, NULL);
|
||||
}
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
// Create up to "maxcount" tabpages with empty windows.
|
||||
// Returns the number of resulting tab pages.
|
||||
@@ -4494,12 +4496,13 @@ void goto_tabpage_tp(tabpage_T *tp, bool trigger_enter_autocmds, bool trigger_le
|
||||
/// @return true if the tab page is valid, false otherwise.
|
||||
bool goto_tabpage_lastused(void)
|
||||
{
|
||||
if (valid_tabpage(lastused_tabpage)) {
|
||||
if (!valid_tabpage(lastused_tabpage)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
goto_tabpage_tp(lastused_tabpage, true, true);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// Enter window "wp" in tab page "tp".
|
||||
// Also updates the GUI tab.
|
||||
@@ -7250,12 +7253,13 @@ static void clear_snapshot(tabpage_T *tp, int idx)
|
||||
|
||||
static void clear_snapshot_rec(frame_T *fr)
|
||||
{
|
||||
if (fr != NULL) {
|
||||
if (fr == NULL) {
|
||||
return;
|
||||
}
|
||||
clear_snapshot_rec(fr->fr_next);
|
||||
clear_snapshot_rec(fr->fr_child);
|
||||
xfree(fr);
|
||||
}
|
||||
}
|
||||
|
||||
/// Traverse a snapshot to find the previous curwin.
|
||||
static win_T *get_snapshot_curwin_rec(frame_T *ft)
|
||||
|
Reference in New Issue
Block a user