patch 9.0.1115: code is indented more than needed
Problem: Code is indented more than needed.
Solution: Use an early return to reduce indenting. (Yegappan Lakshmanan,
closes #11758)
diff --git a/src/ex_getln.c b/src/ex_getln.c
index 5614ea6..4884ebd 100644
--- a/src/ex_getln.c
+++ b/src/ex_getln.c
@@ -368,36 +368,36 @@
incsearch_state_T *is_state,
int call_update_screen)
{
- if (is_state->did_incsearch)
+ if (!is_state->did_incsearch)
+ return;
+
+ is_state->did_incsearch = FALSE;
+ if (gotesc)
+ curwin->w_cursor = is_state->save_cursor;
+ else
{
- is_state->did_incsearch = FALSE;
- if (gotesc)
- curwin->w_cursor = is_state->save_cursor;
- else
+ if (!EQUAL_POS(is_state->save_cursor, is_state->search_start))
{
- if (!EQUAL_POS(is_state->save_cursor, is_state->search_start))
- {
- // put the '" mark at the original position
- curwin->w_cursor = is_state->save_cursor;
- setpcmark();
- }
- curwin->w_cursor = is_state->search_start;
+ // put the '" mark at the original position
+ curwin->w_cursor = is_state->save_cursor;
+ setpcmark();
}
- restore_viewstate(&is_state->old_viewstate);
- highlight_match = FALSE;
-
- // by default search all lines
- search_first_line = 0;
- search_last_line = MAXLNUM;
-
- magic_overruled = is_state->magic_overruled_save;
-
- validate_cursor(); // needed for TAB
- status_redraw_all();
- redraw_all_later(UPD_SOME_VALID);
- if (call_update_screen)
- update_screen(UPD_SOME_VALID);
+ curwin->w_cursor = is_state->search_start;
}
+ restore_viewstate(&is_state->old_viewstate);
+ highlight_match = FALSE;
+
+ // by default search all lines
+ search_first_line = 0;
+ search_last_line = MAXLNUM;
+
+ magic_overruled = is_state->magic_overruled_save;
+
+ validate_cursor(); // needed for TAB
+ status_redraw_all();
+ redraw_all_later(UPD_SOME_VALID);
+ if (call_update_screen)
+ update_screen(UPD_SOME_VALID);
}
/*
@@ -4032,13 +4032,13 @@
char_u *p;
p = alloc(STRLEN(*pp) + 2);
- if (p != NULL)
- {
- p[0] = '\\';
- STRCPY(p + 1, *pp);
- vim_free(*pp);
- *pp = p;
- }
+ if (p == NULL)
+ return;
+
+ p[0] = '\\';
+ STRCPY(p + 1, *pp);
+ vim_free(*pp);
+ *pp = p;
}
/*