0
0
mirror of https://github.com/vim/vim.git synced 2025-08-26 20:03:41 -04:00

patch 9.0.1158: code is indented more than necessary

Problem:    Code is indented more than necessary.
Solution:   Use an early return where it makes sense. (Yegappan Lakshmanan,
            closes #11787)
This commit is contained in:
Yegappan Lakshmanan 2023-01-08 13:44:24 +00:00 committed by Bram Moolenaar
parent df8f947359
commit 7f8b2559a3
14 changed files with 1274 additions and 1266 deletions

View File

@ -1426,12 +1426,12 @@ ff_push(ff_search_ctx_T *search_ctx, ff_stack_T *stack_ptr)
{
// check for NULL pointer, not to return an error to the user, but
// to prevent a crash
if (stack_ptr != NULL)
{
if (stack_ptr == NULL)
return;
stack_ptr->ffs_prev = search_ctx->ffsc_stack_ptr;
search_ctx->ffsc_stack_ptr = stack_ptr;
}
}
/*
* Pop a dir from the directory stack.

View File

@ -513,14 +513,15 @@ newFoldLevelWin(win_T *wp)
void
foldCheckClose(void)
{
if (*p_fcl != NUL) // can only be "all" right now
{
if (*p_fcl == NUL)
return;
// can only be "all" right now
checkupdate(curwin);
if (checkCloseRec(&curwin->w_folds, curwin->w_cursor.lnum,
(int)curwin->w_p_fdl))
changed_window_setting();
}
}
// checkCloseRec() {{{2
static int
@ -1077,8 +1078,10 @@ foldAdjustVisual(void)
}
if (hasFolding(start->lnum, &start->lnum, NULL))
start->col = 0;
if (hasFolding(end->lnum, NULL, &end->lnum))
{
if (!hasFolding(end->lnum, NULL, &end->lnum))
return;
ptr = ml_get(end->lnum);
end->col = (colnr_T)STRLEN(ptr);
if (end->col > 0 && *p_sel == 'o')
@ -1087,7 +1090,6 @@ foldAdjustVisual(void)
if (has_mbyte)
mb_adjust_cursor();
}
}
// cursor_foldstart() {{{2
/*
@ -1215,12 +1217,12 @@ foldLevelWin(win_T *wp, linenr_T lnum)
static void
checkupdate(win_T *wp)
{
if (wp->w_foldinvalid)
{
if (!wp->w_foldinvalid)
return;
foldUpdate(wp, (linenr_T)1, (linenr_T)MAXLNUM); // will update all
wp->w_foldinvalid = FALSE;
}
}
// setFoldRepeat() {{{2
/*

View File

@ -259,12 +259,12 @@ delete_buff_tail(buffheader_T *buf, int slen)
if (buf->bh_curr == NULL)
return; // nothing to delete
len = (int)STRLEN(buf->bh_curr->b_str);
if (len >= slen)
{
if (len < slen)
return;
buf->bh_curr->b_str[len - slen] = NUL;
buf->bh_space += slen;
}
}
/*
* Add number "n" to buffer "buf".
@ -478,13 +478,13 @@ flush_buffers(flush_buffers_T flush_typeahead)
void
ResetRedobuff(void)
{
if (!block_redo)
{
if (block_redo)
return;
free_buff(&old_redobuff);
old_redobuff = redobuff;
redobuff.bh_first.b_next = NULL;
}
}
/*
* Discard the contents of the redo buffer and restore the previous redo
@ -493,8 +493,9 @@ ResetRedobuff(void)
void
CancelRedo(void)
{
if (!block_redo)
{
if (block_redo)
return;
free_buff(&redobuff);
redobuff = old_redobuff;
old_redobuff.bh_first.b_next = NULL;
@ -502,7 +503,6 @@ CancelRedo(void)
while (read_readbuffers(TRUE) != NUL)
;
}
}
/*
* Save redobuff and old_redobuff to save_redobuff and save_old_redobuff.
@ -520,12 +520,12 @@ saveRedobuff(save_redo_T *save_redo)
// Make a copy, so that ":normal ." in a function works.
s = get_buffcont(&save_redo->sr_redobuff, FALSE);
if (s != NULL)
{
if (s == NULL)
return;
add_buff(&redobuff, s, -1L);
vim_free(s);
}
}
/*
* Restore redobuff and old_redobuff from save_redobuff and save_old_redobuff.
@ -944,8 +944,9 @@ stop_redo_ins(void)
static void
init_typebuf(void)
{
if (typebuf.tb_buf == NULL)
{
if (typebuf.tb_buf != NULL)
return;
typebuf.tb_buf = typebuf_init;
typebuf.tb_noremap = noremapbuf_init;
typebuf.tb_buflen = TYPELEN_INIT;
@ -953,7 +954,6 @@ init_typebuf(void)
typebuf.tb_off = MAXMAPLEN + 4;
typebuf.tb_change_cnt = 1;
}
}
/*
* Returns TRUE when keys cannot be remapped.
@ -1324,12 +1324,12 @@ gotchars(char_u *chars, int len)
void
ungetchars(int len)
{
if (reg_recording != 0)
{
if (reg_recording == 0)
return;
delete_buff_tail(&recordbuff, len);
last_recorded_len -= len;
}
}
/*
* Sync undo. Called when typed characters are obtained from the typeahead
@ -2230,8 +2230,9 @@ f_getcharstr(typval_T *argvars, typval_T *rettv)
{
getchar_common(argvars, rettv);
if (rettv->v_type == VAR_NUMBER)
{
if (rettv->v_type != VAR_NUMBER)
return;
char_u temp[7]; // mbyte-char: 6, NUL: 1
varnumber_T n = rettv->vval.v_number;
int i = 0;
@ -2247,7 +2248,6 @@ f_getcharstr(typval_T *argvars, typval_T *rettv)
rettv->v_type = VAR_STRING;
rettv->vval.v_string = vim_strsave(temp);
}
}
/*
* "getcharmod()" function
@ -4031,10 +4031,10 @@ do_cmdkey_command(int key UNUSED, int flags)
void
reset_last_used_map(mapblock_T *mp)
{
if (last_used_map == mp)
{
if (last_used_map != mp)
return;
last_used_map = NULL;
last_used_sid = -1;
}
}
#endif

View File

@ -1171,9 +1171,11 @@ gui_update_cursor(
return;
gui_check_pos();
if (!gui.cursor_is_valid || force
|| gui.row != gui.cursor_row || gui.col != gui.cursor_col)
{
if (gui.cursor_is_valid && !force
&& gui.row == gui.cursor_row && gui.col == gui.cursor_col)
return;
gui_undraw_cursor();
// If a cursor-less sleep is ongoing, leave the cursor invisible
@ -1393,7 +1395,6 @@ gui_update_cursor(
}
gui.highlight_mask = old_hl_mask;
}
}
#if defined(FEAT_MENU) || defined(PROTO)
static void
@ -2054,14 +2055,14 @@ gui_write(
void
gui_dont_update_cursor(int undraw)
{
if (gui.in_use)
{
if (!gui.in_use)
return;
// Undraw the cursor now, we probably can't do it after the change.
if (undraw)
gui_undraw_cursor();
can_update_cursor = FALSE;
}
}
void
gui_can_update_cursor(void)
@ -2679,8 +2680,9 @@ gui_outstr_nowrap(
void
gui_undraw_cursor(void)
{
if (gui.cursor_is_valid)
{
if (!gui.cursor_is_valid)
return;
// Always redraw the character just before if there is one, because
// with some fonts and characters there can be a one pixel overlap.
int startcol = gui.cursor_col > 0 ? gui.cursor_col - 1 : gui.cursor_col;
@ -2696,7 +2698,6 @@ gui_undraw_cursor(void)
// here in case it wasn't needed to undraw it.
gui.cursor_is_valid = FALSE;
}
}
void
gui_redraw(
@ -3559,8 +3560,9 @@ gui_init_which_components(char_u *oldval UNUSED)
break;
}
if (gui.in_use)
{
if (!gui.in_use)
return;
need_set_size = 0;
fix_size = FALSE;
@ -3690,7 +3692,6 @@ gui_init_which_components(char_u *oldval UNUSED)
if (firstwin->w_winrow != tabline_height())
shell_new_rows(); // recompute window positions and heights
}
}
#if defined(FEAT_GUI_TABLINE) || defined(PROTO)
/*
@ -4768,7 +4769,7 @@ gui_mouse_focus(int x, int y)
return;
/*
* format a mouse click on status line input
* Format a mouse click on status line input,
* ala gui_send_mouse_event(0, x, y, 0, 0);
* Trick: Use a column number -1, so that get_pseudo_mouse_code() will
* generate a K_LEFTMOUSE_NM key code.
@ -4852,14 +4853,15 @@ gui_mouse_correct(void)
need_mouse_correct = FALSE;
wp = gui_mouse_window(IGNORE_POPUP);
if (wp != curwin && wp != NULL) // If in other than current window
{
if (wp == curwin || wp == NULL)
return;
// If in other than current window
validate_cline_row();
gui_mch_setmouse((int)W_ENDCOL(curwin) * gui.char_width - 3,
(W_WINROW(curwin) + curwin->w_wrow) * gui.char_height
+ (gui.char_height) / 2);
}
}
/*
* Find window where the mouse pointer "x" / "y" coordinate is in.
@ -5014,9 +5016,14 @@ display_errors(void)
char_u *p;
if (isatty(2))
fflush(stderr);
else if (error_ga.ga_data != NULL)
{
fflush(stderr);
return;
}
if (error_ga.ga_data == NULL)
return;
// avoid putting up a message box with blanks only
for (p = (char_u *)error_ga.ga_data; *p != NUL; ++p)
if (!isspace(*p))
@ -5030,7 +5037,6 @@ display_errors(void)
}
ga_clear(&error_ga);
}
}
#endif
#if defined(NO_CONSOLE_INPUT) || defined(PROTO)
@ -5339,13 +5345,13 @@ gui_wingoto_xy(int x, int y)
int col = X_2_COL(x);
win_T *wp;
if (row >= 0 && col >= 0)
{
if (row < 0 || col < 0)
return;
wp = mouse_find_win(&row, &col, FAIL_POPUP);
if (wp != NULL && wp != curwin)
win_goto(wp);
}
}
/*
* Function passed to handle_drop() for the actions to be done after the

View File

@ -373,8 +373,9 @@ pointer_event(BalloonEval *beval, int x, int y, unsigned state)
distance = ABS(x - beval->x) + ABS(y - beval->y);
if (distance > 4)
{
if (distance <= 4)
return;
/*
* Moved out of the balloon location: cancel it.
* Remember button state
@ -408,7 +409,6 @@ pointer_event(BalloonEval *beval, int x, int y, unsigned state)
}
}
}
}
static void
key_event(BalloonEval *beval, unsigned keyval, int is_keypress)
@ -698,8 +698,9 @@ timerRoutine(XtPointer dx, XtIntervalId *id UNUSED)
static void
requestBalloon(BalloonEval *beval)
{
if (beval->showState != ShS_PENDING)
{
if (beval->showState == ShS_PENDING)
return;
// Determine the beval to display
if (beval->msgCB != NULL)
{
@ -709,7 +710,6 @@ requestBalloon(BalloonEval *beval)
else if (beval->msg != NULL)
drawBalloon(beval);
}
}
#ifdef FEAT_GUI_GTK
/*
@ -900,8 +900,9 @@ set_printable_label_text(GtkLabel *label, char_u *text)
static void
drawBalloon(BalloonEval *beval)
{
if (beval->msg != NULL)
{
if (beval->msg == NULL)
return;
GtkRequisition requisition;
int screen_w;
int screen_h;
@ -979,7 +980,6 @@ drawBalloon(BalloonEval *beval)
beval->showState = ShS_SHOWING;
gui_mch_update();
}
}
/*
* Undraw a balloon.
@ -1060,8 +1060,9 @@ drawBalloon(BalloonEval *beval)
Position tx;
Position ty;
if (beval->msg != NULL)
{
if (beval->msg == NULL)
return;
XmString s;
// Show the Balloon
@ -1119,7 +1120,6 @@ drawBalloon(BalloonEval *beval)
current_beval = beval;
}
}
/*
* Undraw a balloon.
@ -1161,7 +1161,6 @@ createBalloonEvalWindow(BalloonEval *beval)
beval->balloonShell = XtAppCreateShell("balloonEval", "BalloonEval",
overrideShellWidgetClass, gui.dpy, args, n);
{
XmFontList fl;
n = 0;
@ -1173,7 +1172,6 @@ createBalloonEvalWindow(BalloonEval *beval)
beval->balloonLabel = XtCreateManagedWidget("balloonLabel",
xmLabelWidgetClass, beval->balloonShell, args, n);
}
}
#endif // !FEAT_GUI_GTK
#endif // !FEAT_GUI_MSWIN

View File

@ -924,8 +924,9 @@ get_menu_position(vimmenu_T *menu)
void
gui_mch_menu_set_tip(vimmenu_T *menu)
{
if (menu->id != NULL && menu->parent != NULL && gui.toolbar != NULL)
{
if (menu->id == NULL || menu->parent == NULL || gui.toolbar == NULL)
return;
char_u *tooltip;
tooltip = CONVERT_TO_UTF8(menu->strings[MENU_INDEX_TIP]);
@ -940,7 +941,6 @@ gui_mch_menu_set_tip(vimmenu_T *menu)
# endif
CONVERT_TO_UTF8_FREE(tooltip);
}
}
#endif // FEAT_TOOLBAR
@ -1007,8 +1007,9 @@ gui_mch_destroy_menu(vimmenu_T *menu)
void
gui_mch_set_scrollbar_thumb(scrollbar_T *sb, long val, long size, long max)
{
if (sb->id != NULL)
{
if (sb->id == NULL)
return;
GtkAdjustment *adjustment;
// ignore events triggered by moving the thumb (happens in GTK 3)
@ -1035,7 +1036,6 @@ gui_mch_set_scrollbar_thumb(scrollbar_T *sb, long val, long size, long max)
g_signal_handler_unblock(G_OBJECT(adjustment),
(gulong)sb->handler_id);
}
}
void
gui_mch_set_scrollbar_pos(scrollbar_T *sb, int x, int y, int w, int h)
@ -1157,8 +1157,9 @@ gui_mch_create_scrollbar(scrollbar_T *sb, int orient)
sb->id = gtk_vscrollbar_new(NULL);
#endif
if (sb->id != NULL)
{
if (sb->id == NULL)
return;
GtkAdjustment *adjustment;
gtk_widget_set_can_focus(sb->id, FALSE);
@ -1172,7 +1173,6 @@ gui_mch_create_scrollbar(scrollbar_T *sb, int orient)
GINT_TO_POINTER(sb->ident));
gui_mch_update();
}
}
void
gui_mch_destroy_scrollbar(scrollbar_T *sb)
@ -1994,9 +1994,9 @@ gui_make_popup(char_u *path_name, int mouse_pos)
popup_mouse_pos = mouse_pos;
menu = gui_find_menu(path_name);
if (menu == NULL || menu->submenu_id == NULL)
return;
if (menu != NULL && menu->submenu_id != NULL)
{
# if GTK_CHECK_VERSION(3,22,2)
GdkWindow * const win = gtk_widget_get_window(gui.drawarea);
GdkEventButton trigger;
@ -2047,7 +2047,6 @@ gui_make_popup(char_u *path_name, int mouse_pos)
0U, (guint32)GDK_CURRENT_TIME);
# endif
}
}
#endif // FEAT_MENU

View File

@ -188,15 +188,15 @@ gui_gtk_form_thaw(GtkForm *form)
{
g_return_if_fail(GTK_IS_FORM(form));
if (form->freeze_count)
{
if (!form->freeze_count)
return;
if (!(--form->freeze_count))
{
form_position_children(form);
gtk_widget_queue_draw(GTK_WIDGET(form));
}
}
}
// Basic Object handling procedures
@ -610,8 +610,9 @@ form_remove(GtkContainer *container, GtkWidget *widget)
tmp_list = tmp_list->next;
}
if (tmp_list)
{
if (tmp_list == NULL)
return;
#if GTK_CHECK_VERSION(3,0,0)
const gboolean was_visible = gtk_widget_get_visible(widget);
#endif
@ -636,7 +637,6 @@ form_remove(GtkContainer *container, GtkWidget *widget)
g_list_free_1(tmp_list);
g_free(child);
}
}
static void
form_forall(GtkContainer *container,

View File

@ -2435,9 +2435,9 @@ setup_save_yourself(void)
GnomeClient *client;
client = gnome_master_client();
if (client == NULL)
return;
if (client != NULL)
{
// Must use the deprecated gtk_signal_connect() for compatibility
// with GNOME 1. Arrgh, zombies!
gtk_signal_connect(GTK_OBJECT(client), "save_yourself",
@ -2445,7 +2445,6 @@ setup_save_yourself(void)
gtk_signal_connect(GTK_OBJECT(client), "die",
GTK_SIGNAL_FUNC(&sm_client_die), NULL);
}
}
#else // !USE_GNOME_SESSION
@ -3379,14 +3378,14 @@ on_tab_reordered(
gint idx,
gpointer data UNUSED)
{
if (!ignore_tabline_evt)
{
if (ignore_tabline_evt)
return;
if ((tabpage_index(curtab) - 1) < idx)
tabpage_move(idx + 1);
else
tabpage_move(idx);
}
}
# endif
/*
@ -4069,8 +4068,9 @@ gui_mch_init(void)
void
gui_mch_forked(void)
{
if (using_gnome)
{
if (!using_gnome)
return;
GnomeClient *client;
client = gnome_master_client();
@ -4078,7 +4078,6 @@ gui_mch_forked(void)
if (client != NULL)
gnome_client_set_process_id(client, getpid());
}
}
#endif // USE_GNOME_SESSION
#if GTK_CHECK_VERSION(3,0,0)
@ -6860,12 +6859,12 @@ clip_mch_request_selection(Clipboard_T *cbd)
void
clip_mch_lose_selection(Clipboard_T *cbd UNUSED)
{
if (!in_selection_clear_event)
{
if (in_selection_clear_event)
return;
gtk_selection_owner_set(NULL, cbd->gtk_sel_atom, gui.event_time);
gui_mch_update();
}
}
/*
* Own the selection and return OK if it worked.
@ -7029,8 +7028,9 @@ static int last_shape = 0;
void
gui_mch_mousehide(int hide)
{
if (gui.pointer_hidden != hide)
{
if (gui.pointer_hidden == hide)
return;
gui.pointer_hidden = hide;
if (gtk_widget_get_window(gui.drawarea) && gui.blank_pointer != NULL)
{
@ -7045,7 +7045,6 @@ gui_mch_mousehide(int hide)
#endif
}
}
}
#if defined(FEAT_MOUSESHAPE) || defined(PROTO)
@ -7132,9 +7131,10 @@ gui_mch_drawsign(int row, int col, int typenr)
sign = (GdkPixbuf *)sign_get_image(typenr);
if (sign != NULL && gui.drawarea != NULL
&& gtk_widget_get_window(gui.drawarea) != NULL)
{
if (sign == NULL || gui.drawarea == NULL
|| gtk_widget_get_window(gui.drawarea) == NULL)
return;
int width;
int height;
int xoffset;
@ -7267,7 +7267,6 @@ gui_mch_drawsign(int row, int col, int typenr)
if (need_scale)
g_object_unref(sign);
}
}
void *
gui_mch_register_sign(char_u *signfile)

View File

@ -979,15 +979,15 @@ gui_motif_add_actext(vimmenu_T *menu)
XmString label;
// Add accelerator text, if there is one
if (menu->actext != NULL && menu->id != (Widget)0)
{
if (menu->actext == NULL || menu->id == (Widget)0)
return;
label = XmStringCreate((char *)menu->actext, STRING_TAG);
if (label == NULL)
return;
XtVaSetValues(menu->id, XmNacceleratorText, label, NULL);
XmStringFree(label);
}
}
void
gui_mch_toggle_tearoffs(int enable)
@ -1573,8 +1573,9 @@ gui_mch_destroy_menu(vimmenu_T *menu)
menu->submenu_id = (Widget)0;
}
if (menu->id != (Widget)0)
{
if (menu->id == (Widget)0)
return;
Widget parent;
parent = XtParent(menu->id);
@ -1611,7 +1612,6 @@ gui_mch_destroy_menu(vimmenu_T *menu)
}
#endif
}
}
void
gui_mch_show_popupmenu(vimmenu_T *menu UNUSED)
@ -1630,8 +1630,9 @@ gui_mch_show_popupmenu(vimmenu_T *menu UNUSED)
void
gui_mch_def_colors(void)
{
if (gui.in_use)
{
if (!gui.in_use)
return;
gui.menu_fg_pixel = gui_get_color((char_u *)gui.rsrc_menu_fg_name);
gui.menu_bg_pixel = gui_get_color((char_u *)gui.rsrc_menu_bg_name);
gui.scroll_fg_pixel = gui_get_color((char_u *)gui.rsrc_scroll_fg_name);
@ -1643,7 +1644,6 @@ gui_mch_def_colors(void)
gui_get_color((char_u *)gui.rsrc_tooltip_bg_name);
#endif
}
}
/*
@ -1674,8 +1674,9 @@ gui_mch_set_scrollbar_pos(
int w,
int h)
{
if (sb->id != (Widget)0)
{
if (sb->id == (Widget)0)
return;
if (sb->type == SBAR_LEFT || sb->type == SBAR_RIGHT)
{
if (y == 0)
@ -1698,7 +1699,6 @@ gui_mch_set_scrollbar_pos(
NULL);
XtManageChild(sb->id);
}
}
int
gui_mch_get_scrollbar_xpadding(void)
@ -1732,8 +1732,9 @@ gui_mch_enable_scrollbar(scrollbar_T *sb, int flag)
Arg args[16];
int n;
if (sb->id != (Widget)0)
{
if (sb->id == (Widget)0)
return;
n = 0;
if (flag)
{
@ -1779,7 +1780,6 @@ gui_mch_enable_scrollbar(scrollbar_T *sb, int flag)
XtUnmanageChild(sb->id);
}
}
}
void
gui_mch_create_scrollbar(
@ -1817,9 +1817,9 @@ gui_mch_create_scrollbar(
sb->id = XtCreateWidget("scrollBar",
xmScrollBarWidgetClass, textAreaForm, args, n);
if (sb->id == (Widget)0)
return;
if (sb->id != (Widget)0)
{
gui_mch_set_scrollbar_colors(sb);
XtAddCallback(sb->id, XmNvalueChangedCallback,
scroll_cb, (XtPointer)sb->ident);
@ -1828,7 +1828,6 @@ gui_mch_create_scrollbar(
XtAddEventHandler(sb->id, KeyPressMask, FALSE, gui_x11_key_hit_cb,
(XtPointer)0);
}
}
void
gui_mch_destroy_scrollbar(scrollbar_T *sb)

View File

@ -992,8 +992,9 @@ gui_ph_pg_add_buffer(char *name)
char **new_titles = NULL;
new_titles = ALLOC_MULT(char *, (num_panels + 1));
if (new_titles != NULL)
{
if (new_titles == NULL)
return;
if (num_panels > 0)
memcpy(new_titles, panel_titles, num_panels * sizeof(char **));
@ -1005,7 +1006,6 @@ gui_ph_pg_add_buffer(char *name)
vim_free(panel_titles);
panel_titles = new_titles;
}
}
static void
gui_ph_pg_remove_buffer(char *name)
@ -1901,8 +1901,9 @@ mch_set_mouse_shape(int shape)
void
gui_mch_mousehide(int hide)
{
if (gui.pointer_hidden != hide)
{
if (gui.pointer_hidden == hide)
return;
gui.pointer_hidden = hide;
#ifdef FEAT_MOUSESHAPE
if (hide)
@ -1916,7 +1917,6 @@ gui_mch_mousehide(int hide)
0);
#endif
}
}
void
gui_mch_getmouse(int *x, int *y)

View File

@ -434,13 +434,13 @@ directx_enabled(void)
static void
directx_binddc(void)
{
if (s_textArea != NULL)
{
if (s_textArea == NULL)
return;
RECT rect;
GetClientRect(s_textArea, &rect);
DWriteContext_BindDC(s_dwc, s_hdc, &rect);
}
}
#endif
extern int current_font_height; // this is in os_mswin.c
@ -663,15 +663,15 @@ gui_mswin_rm_blink_timer(void)
{
MSG msg;
if (blink_timer != 0)
{
if (blink_timer == 0)
return;
KillTimer(NULL, blink_timer);
// Eat spurious WM_TIMER messages
while (PeekMessageW(&msg, s_hwnd, WM_TIMER, WM_TIMER, PM_REMOVE))
;
blink_timer = 0;
}
}
/*
* Stop the cursor blinking. Show the cursor if it wasn't shown.
@ -1034,8 +1034,10 @@ _OnMouseButtonDown(
else
button = MOUSE_LEFT;
}
if (button >= 0)
{
if (button < 0)
return;
repeated_click = ((int)(currentTime - s_prevTime) < p_mouset);
/*
@ -1091,7 +1093,6 @@ _OnMouseButtonDown(
s_prevTime = currentTime;
}
}
static void
_OnMouseMoveOrRelease(
@ -1233,8 +1234,9 @@ _OnFindRepl(void)
flags = FRD_REPLACEALL;
}
if (flags != 0)
{
if (flags == 0)
return;
char_u *p, *q;
// Call the generic GUI function to do the actual work.
@ -1250,7 +1252,6 @@ _OnFindRepl(void)
vim_free(p);
vim_free(q);
}
}
#endif
static void
@ -2932,12 +2933,12 @@ gui_mch_replace_dialog(exarg_T *eap)
void
gui_mch_mousehide(int hide)
{
if (hide != gui.pointer_hidden)
{
if (hide == gui.pointer_hidden)
return;
ShowCursor(!hide);
gui.pointer_hidden = hide;
}
}
#ifdef FEAT_MENU
static void
@ -2993,8 +2994,9 @@ _OnDestroy(HWND hwnd)
_OnPaint(
HWND hwnd)
{
if (!IsMinimized(hwnd))
{
if (IsMinimized(hwnd))
return;
PAINTSTRUCT ps;
out_flush(); // make sure all output has been processed
@ -3020,7 +3022,6 @@ _OnPaint(
EndPaint(hwnd, &ps);
}
}
static void
_OnSize(
@ -3904,8 +3905,9 @@ _OnDropFiles(
DragFinish(hDrop);
if (fnames != NULL)
{
if (fnames == NULL)
return;
int kbd_modifiers = get_active_modifiers();
if ((kbd_modifiers & MOD_MASK_SHIFT) != 0)
@ -3919,7 +3921,6 @@ _OnDropFiles(
s_need_activate = TRUE;
}
}
static int
_OnScroll(
@ -4461,12 +4462,12 @@ show_sizing_tip(int cols, int rows)
static void
destroy_sizing_tip(void)
{
if (hwndTip != NULL)
{
if (hwndTip == NULL)
return;
DestroyWindow(hwndTip);
hwndTip = NULL;
}
}
static int
_DuringSizing(
@ -5844,8 +5845,9 @@ im_set_active(int active)
}
# endif
if (pImmGetContext) // if NULL imm32.dll wasn't loaded (yet)
{
if (!pImmGetContext) // if NULL imm32.dll wasn't loaded (yet)
return;
if (p_imdisable)
{
if (hImcOld == (HIMC)0)
@ -5863,8 +5865,9 @@ im_set_active(int active)
}
hImc = pImmGetContext(s_hwnd);
if (hImc)
{
if (!hImc)
return;
/*
* for Korean ime
*/
@ -5901,8 +5904,6 @@ im_set_active(int active)
pImmSetOpenStatus(hImc, active);
pImmReleaseContext(s_hwnd, hImc);
}
}
}
/*
* Get IM status. When IM is on, return not 0. Else return 0.
@ -6459,8 +6460,9 @@ gui_make_popup(char_u *path_name, int mouse_pos)
{
vimmenu_T *menu = gui_find_menu(path_name);
if (menu != NULL)
{
if (menu == NULL)
return;
POINT p;
// Find the position of the current cursor
@ -6481,7 +6483,6 @@ gui_make_popup(char_u *path_name, int mouse_pos)
msg_scroll = FALSE;
gui_mch_show_popupmenu_at(menu, (int)p.x, (int)p.y);
}
}
# if defined(FEAT_TEAROFF) || defined(PROTO)
/*
@ -8274,7 +8275,9 @@ gui_mch_drawsign(int row, int col, int typenr)
static void
close_signicon_image(signicon_t *sign)
{
if (sign)
if (sign == NULL)
return;
switch (sign->uType)
{
case IMAGE_BITMAP:
@ -8347,12 +8350,12 @@ gui_mch_register_sign(char_u *signfile)
void
gui_mch_destroy_sign(void *sign)
{
if (sign)
{
if (sign == NULL)
return;
close_signicon_image((signicon_t *)sign);
vim_free(sign);
}
}
#endif
#if defined(FEAT_BEVAL_GUI) || defined(PROTO)
@ -8561,8 +8564,9 @@ Handle_WM_Notify(HWND hwnd UNUSED, LPNMHDR pnmh)
if (pnmh->idFrom != ID_BEVAL_TOOLTIP) // it is not our tooltip
return;
if (cur_beval != NULL)
{
if (cur_beval == NULL)
return;
switch (pnmh->code)
{
case TTN_SHOW:
@ -8591,7 +8595,6 @@ Handle_WM_Notify(HWND hwnd UNUSED, LPNMHDR pnmh)
break;
}
}
}
static void
track_user_activity(UINT uMsg)

View File

@ -2194,12 +2194,12 @@ gui_mch_get_rgb_color(int r, int g, int b)
void
gui_mch_set_fg_color(guicolor_T color)
{
if (color != prev_fg_color)
{
if (color == prev_fg_color)
return;
XSetForeground(gui.dpy, gui.text_gc, (Pixel)color);
prev_fg_color = color;
}
}
/*
* Set the current text background color.
@ -2207,12 +2207,12 @@ gui_mch_set_fg_color(guicolor_T color)
void
gui_mch_set_bg_color(guicolor_T color)
{
if (color != prev_bg_color)
{
if (color == prev_bg_color)
return;
XSetBackground(gui.dpy, gui.text_gc, (Pixel)color);
prev_bg_color = color;
}
}
/*
* Set the current text special color.
@ -2814,8 +2814,9 @@ clip_mch_set_selection(
void
gui_mch_menu_grey(vimmenu_T *menu, int grey)
{
if (menu->id != (Widget)0)
{
if (menu->id == (Widget)0)
return;
gui_mch_menu_hidden(menu, False);
if (grey
#ifdef FEAT_GUI_MOTIF
@ -2826,7 +2827,6 @@ gui_mch_menu_grey(vimmenu_T *menu, int grey)
else
XtSetSensitive(menu->id, True);
}
}
/*
* Make menu item hidden or not hidden
@ -2834,14 +2834,14 @@ gui_mch_menu_grey(vimmenu_T *menu, int grey)
void
gui_mch_menu_hidden(vimmenu_T *menu, int hidden)
{
if (menu->id != (Widget)0)
{
if (menu->id == (Widget)0)
return;
if (hidden)
XtUnmanageChild(menu->id);
else
XtManageChild(menu->id);
}
}
/*
* This is called after setting all the menus to grey/hidden or not.
@ -3130,8 +3130,9 @@ gui_mch_drawsign(int row, int col, int typenr)
{
XImage *sign;
if (gui.in_use && (sign = (XImage *)sign_get_image(typenr)) != NULL)
{
if (!gui.in_use || (sign = (XImage *)sign_get_image(typenr)) == NULL)
return;
XClearArea(gui.dpy, gui.wid, TEXT_X(col), TEXT_Y(row) - sign->height,
SIGN_WIDTH, gui.char_height, FALSE);
XPutImage(gui.dpy, gui.wid, gui.text_gc, sign, 0, 0,
@ -3139,7 +3140,6 @@ gui_mch_drawsign(int row, int col, int typenr)
TEXT_Y(row) - sign->height,
sign->width, sign->height);
}
}
void *
gui_mch_register_sign(char_u *signfile)
@ -3202,8 +3202,9 @@ static int last_shape = 0;
gui_mch_mousehide(
int hide) // TRUE = use blank ptr, FALSE = use parent ptr
{
if (gui.pointer_hidden != hide)
{
if (gui.pointer_hidden == hide)
return;
gui.pointer_hidden = hide;
if (hide)
XDefineCursor(gui.dpy, gui.wid, gui.blank_pointer);
@ -3214,7 +3215,6 @@ gui_mch_mousehide(
XUndefineCursor(gui.dpy, gui.wid);
#endif
}
}
#if defined(FEAT_MOUSESHAPE) || defined(PROTO)
@ -3280,9 +3280,10 @@ mch_set_mouse_shape(int shape)
void
gui_mch_menu_set_tip(vimmenu_T *menu)
{
if (menu->id != NULL && menu->parent != NULL
&& menu_is_toolbar(menu->parent->name))
{
if (menu->id == NULL || menu->parent == NULL
|| !menu_is_toolbar(menu->parent->name))
return;
// Always destroy and create the balloon, in case the string was
// changed.
if (menu->tip != NULL)
@ -3297,5 +3298,4 @@ gui_mch_menu_set_tip(vimmenu_T *menu)
NULL,
NULL);
}
}
#endif

View File

@ -199,20 +199,21 @@ im_set_active(int active)
void
xim_set_focus(int focus)
{
if (xic != NULL)
{
if (xic == NULL)
return;
if (focus)
gtk_im_context_focus_in(xic);
else
gtk_im_context_focus_out(xic);
}
}
void
im_set_position(int row, int col)
{
if (xic != NULL)
{
if (xic == NULL)
return;
GdkRectangle area;
area.x = FILL_X(col);
@ -225,7 +226,6 @@ im_set_position(int row, int col)
if (p_imst == IM_OVER_THE_SPOT)
im_preedit_window_set_position();
}
}
# if 0 || defined(PROTO) // apparently only used in gui_x11.c
void

View File

@ -695,6 +695,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
1158,
/**/
1157,
/**/