# HG changeset patch # User vimboss # Date 1156865407 0 # Node ID b2dcb84570675cbdb4fea2d017bcd093b3f34be3 # Parent e70aad5761b59933a1f69a8756457fdb3a9aad40 updated for version 7.0-070 diff --git a/src/edit.c b/src/edit.c --- a/src/edit.c +++ b/src/edit.c @@ -129,7 +129,7 @@ static expand_T compl_xp; static void ins_ctrl_x __ARGS((void)); static int has_compl_option __ARGS((int dict_opt)); -static int ins_compl_add __ARGS((char_u *str, int len, int icase, char_u *fname, char_u **cptext, int cdir, int flags, int dup)); +static int ins_compl_add __ARGS((char_u *str, int len, int icase, char_u *fname, char_u **cptext, int cdir, int flags, int adup)); static int ins_compl_equal __ARGS((compl_T *match, char_u *str, int len)); static void ins_compl_longest_match __ARGS((compl_T *match)); static void ins_compl_add_matches __ARGS((int num_matches, char_u **matches, int icase)); @@ -2118,7 +2118,7 @@ ins_compl_add_infercase(str, len, icase, * maybe because alloc() returns NULL, then FAIL is returned. */ static int -ins_compl_add(str, len, icase, fname, cptext, cdir, flags, dup) +ins_compl_add(str, len, icase, fname, cptext, cdir, flags, adup) char_u *str; int len; int icase; @@ -2126,7 +2126,7 @@ ins_compl_add(str, len, icase, fname, cp char_u **cptext; /* extra text for popup menu or NULL */ int cdir; int flags; - int dup; /* accept duplicate match */ + int adup; /* accept duplicate match */ { compl_T *match; int dir = (cdir == 0 ? compl_direction : cdir); @@ -2140,7 +2140,7 @@ ins_compl_add(str, len, icase, fname, cp /* * If the same match is already present, don't add it. */ - if (compl_first_match != NULL && !dup) + if (compl_first_match != NULL && !adup) { match = compl_first_match; do @@ -3608,7 +3608,7 @@ ins_compl_add_tv(tv, dir) { char_u *word; int icase = FALSE; - int dup = FALSE; + int adup = FALSE; char_u *(cptext[CPT_COUNT]); if (tv->v_type == VAR_DICT && tv->vval.v_dict != NULL) @@ -3625,7 +3625,7 @@ ins_compl_add_tv(tv, dir) if (get_dict_string(tv->vval.v_dict, (char_u *)"icase", FALSE) != NULL) icase = get_dict_number(tv->vval.v_dict, (char_u *)"icase"); if (get_dict_string(tv->vval.v_dict, (char_u *)"dup", FALSE) != NULL) - dup = get_dict_number(tv->vval.v_dict, (char_u *)"dup"); + adup = get_dict_number(tv->vval.v_dict, (char_u *)"dup"); } else { @@ -3634,7 +3634,7 @@ ins_compl_add_tv(tv, dir) } if (word == NULL || *word == NUL) return FAIL; - return ins_compl_add(word, -1, icase, NULL, cptext, dir, 0, dup); + return ins_compl_add(word, -1, icase, NULL, cptext, dir, 0, adup); } #endif diff --git a/src/eval.c b/src/eval.c --- a/src/eval.c +++ b/src/eval.c @@ -454,7 +454,7 @@ static int find_internal_func __ARGS((ch static char_u *deref_func_name __ARGS((char_u *name, int *lenp)); static int get_func_tv __ARGS((char_u *name, int len, typval_T *rettv, char_u **arg, linenr_T firstline, linenr_T lastline, int *doesrange, int evaluate, dict_T *selfdict)); static int call_func __ARGS((char_u *name, int len, typval_T *rettv, int argcount, typval_T *argvars, linenr_T firstline, linenr_T lastline, int *doesrange, int evaluate, dict_T *selfdict)); -static void emsg_funcname __ARGS((char *msg, char_u *name)); +static void emsg_funcname __ARGS((char *ermsg, char_u *name)); static void f_add __ARGS((typval_T *argvars, typval_T *rettv)); static void f_append __ARGS((typval_T *argvars, typval_T *rettv)); @@ -2260,7 +2260,7 @@ ex_let_one(arg, tv, copy, endchars, op) EMSG(_(e_letunexp)); else { - char_u *tofree = NULL; + char_u *ptofree = NULL; char_u *s; p = get_tv_string_chk(tv); @@ -2269,7 +2269,7 @@ ex_let_one(arg, tv, copy, endchars, op) s = get_reg_contents(*arg == '@' ? '"' : *arg, TRUE, TRUE); if (s != NULL) { - p = tofree = concat_str(s, p); + p = ptofree = concat_str(s, p); vim_free(s); } } @@ -2278,7 +2278,7 @@ ex_let_one(arg, tv, copy, endchars, op) write_reg_contents(*arg == '@' ? '"' : *arg, p, -1, FALSE); arg_end = arg + 1; } - vim_free(tofree); + vim_free(ptofree); } } @@ -7595,8 +7595,8 @@ call_func(name, len, rettv, argcount, ar * Give an error message with a function name. Handle things. */ static void -emsg_funcname(msg, name) - char *msg; +emsg_funcname(ermsg, name) + char *ermsg; char_u *name; { char_u *p; @@ -7605,7 +7605,7 @@ emsg_funcname(msg, name) p = concat_str((char_u *)"", name + 3); else p = name; - EMSG2(_(msg), p); + EMSG2(_(ermsg), p); if (p != name) vim_free(p); } @@ -9179,25 +9179,25 @@ filter_map(argvars, rettv, map) typval_T save_key; int rem; int todo; - char_u *msg = map ? (char_u *)"map()" : (char_u *)"filter()"; + char_u *ermsg = map ? (char_u *)"map()" : (char_u *)"filter()"; int save_did_emsg; rettv->vval.v_number = 0; if (argvars[0].v_type == VAR_LIST) { if ((l = argvars[0].vval.v_list) == NULL - || (map && tv_check_lock(l->lv_lock, msg))) + || (map && tv_check_lock(l->lv_lock, ermsg))) return; } else if (argvars[0].v_type == VAR_DICT) { if ((d = argvars[0].vval.v_dict) == NULL - || (map && tv_check_lock(d->dv_lock, msg))) + || (map && tv_check_lock(d->dv_lock, ermsg))) return; } else { - EMSG2(_(e_listdictarg), msg); + EMSG2(_(e_listdictarg), ermsg); return; } @@ -9229,7 +9229,7 @@ filter_map(argvars, rettv, map) { --todo; di = HI2DI(hi); - if (tv_check_lock(di->di_tv.v_lock, msg)) + if (tv_check_lock(di->di_tv.v_lock, ermsg)) break; vimvars[VV_KEY].vv_str = vim_strsave(di->di_key); if (filter_map_one(&di->di_tv, expr, map, &rem) == FAIL @@ -9248,7 +9248,7 @@ filter_map(argvars, rettv, map) { for (li = l->lv_first; li != NULL; li = nli) { - if (tv_check_lock(li->li_tv.v_lock, msg)) + if (tv_check_lock(li->li_tv.v_lock, ermsg)) break; nli = li->li_next; if (filter_map_one(&li->li_tv, expr, map, &rem) == FAIL @@ -19789,7 +19789,7 @@ call_user_func(fp, argcount, argvars, re if (p_verbose >= 14) { char_u buf[MSG_BUF_LEN]; - char_u numbuf[NUMBUFLEN]; + char_u numbuf2[NUMBUFLEN]; char_u *tofree; msg_puts((char_u *)"("); @@ -19801,8 +19801,8 @@ call_user_func(fp, argcount, argvars, re msg_outnum((long)argvars[i].vval.v_number); else { - trunc_string(tv2string(&argvars[i], &tofree, numbuf, 0), - buf, MSG_BUF_CLEN); + trunc_string(tv2string(&argvars[i], &tofree, + numbuf2, 0), buf, MSG_BUF_CLEN); msg_puts(buf); vim_free(tofree); } @@ -19880,13 +19880,13 @@ call_user_func(fp, argcount, argvars, re else { char_u buf[MSG_BUF_LEN]; - char_u numbuf[NUMBUFLEN]; + char_u numbuf2[NUMBUFLEN]; char_u *tofree; /* The value may be very long. Skip the middle part, so that we * have some idea how it starts and ends. smsg() would always * truncate it at the end. */ - trunc_string(tv2string(fc.rettv, &tofree, numbuf, 0), + trunc_string(tv2string(fc.rettv, &tofree, numbuf2, 0), buf, MSG_BUF_CLEN); smsg((char_u *)_("%s returning %s"), sourcing_name, buf); vim_free(tofree); diff --git a/src/ex_cmds.c b/src/ex_cmds.c --- a/src/ex_cmds.c +++ b/src/ex_cmds.c @@ -185,6 +185,7 @@ ex_align(eap) new_indent = indent; else { + has_tab = FALSE; /* avoid uninit warnings */ len = linelen(eap->cmdidx == CMD_right ? &has_tab : NULL) - get_indent(); @@ -1772,10 +1773,9 @@ write_viminfo(file, forceit) ? (st_old.st_mode & 0020) : (st_old.st_mode & 0002)))) { - int tt; + int tt = msg_didany; /* avoid a wait_return for this message, it's annoying */ - tt = msg_didany; EMSG2(_("E137: Viminfo file is not writable: %s"), fname); msg_didany = tt; fclose(fp_in); diff --git a/src/ex_cmds2.c b/src/ex_cmds2.c --- a/src/ex_cmds2.c +++ b/src/ex_cmds2.c @@ -3648,13 +3648,13 @@ do_finish(eap, reanimate) * Return FALSE when not sourcing a file. */ int -source_finished(getline, cookie) - char_u *(*getline) __ARGS((int, void *, int)); +source_finished(fgetline, cookie) + char_u *(*fgetline) __ARGS((int, void *, int)); void *cookie; { - return (getline_equal(getline, cookie, getsourceline) + return (getline_equal(fgetline, cookie, getsourceline) && ((struct source_cookie *)getline_cookie( - getline, cookie))->finished); + fgetline, cookie))->finished); } #endif diff --git a/src/ex_docmd.c b/src/ex_docmd.c --- a/src/ex_docmd.c +++ b/src/ex_docmd.c @@ -58,9 +58,9 @@ static char_u *get_user_command_name __A #endif #ifdef FEAT_EVAL -static char_u *do_one_cmd __ARGS((char_u **, int, struct condstack *, char_u *(*getline)(int, void *, int), void *cookie)); +static char_u *do_one_cmd __ARGS((char_u **, int, struct condstack *, char_u *(*fgetline)(int, void *, int), void *cookie)); #else -static char_u *do_one_cmd __ARGS((char_u **, int, char_u *(*getline)(int, void *, int), void *cookie)); +static char_u *do_one_cmd __ARGS((char_u **, int, char_u *(*fgetline)(int, void *, int), void *cookie)); static int if_level = 0; /* depth in :if */ #endif static char_u *find_command __ARGS((exarg_T *eap, int *full)); @@ -831,10 +831,13 @@ do_cmdline(cmdline, getline, cookie, fla /* * If requested, store and reset the global values controlling the - * exception handling (used when debugging). + * exception handling (used when debugging). Otherwise clear it to avoid + * a bogus compiler warning when the optimizer uses inline functions... */ if (flags & DOCMD_EXCRESET) save_dbg_stuff(&debug_saved); + else + memset(&debug_saved, 0, 1); initial_trylevel = trylevel; @@ -1574,24 +1577,24 @@ free_cmdlines(gap) #endif /* - * If "getline" is get_loop_line(), return TRUE if the getline it uses equals - * "func". * Otherwise return TRUE when "getline" equals "func". + * If "fgetline" is get_loop_line(), return TRUE if the getline it uses equals + * "func". * Otherwise return TRUE when "fgetline" equals "func". */ /*ARGSUSED*/ int -getline_equal(getline, cookie, func) - char_u *(*getline) __ARGS((int, void *, int)); - void *cookie; /* argument for getline() */ +getline_equal(fgetline, cookie, func) + char_u *(*fgetline) __ARGS((int, void *, int)); + void *cookie; /* argument for fgetline() */ char_u *(*func) __ARGS((int, void *, int)); { #ifdef FEAT_EVAL char_u *(*gp) __ARGS((int, void *, int)); struct loop_cookie *cp; - /* When "getline" is "get_loop_line()" use the "cookie" to find the + /* When "fgetline" is "get_loop_line()" use the "cookie" to find the * function that's orignally used to obtain the lines. This may be nested * several levels. */ - gp = getline; + gp = fgetline; cp = (struct loop_cookie *)cookie; while (gp == get_loop_line) { @@ -1600,29 +1603,29 @@ getline_equal(getline, cookie, func) } return gp == func; #else - return getline == func; + return fgetline == func; #endif } #if defined(FEAT_EVAL) || defined(FEAT_MBYTE) || defined(PROTO) /* - * If "getline" is get_loop_line(), return the cookie used by the original + * If "fgetline" is get_loop_line(), return the cookie used by the original * getline function. Otherwise return "cookie". */ /*ARGSUSED*/ void * -getline_cookie(getline, cookie) - char_u *(*getline) __ARGS((int, void *, int)); - void *cookie; /* argument for getline() */ +getline_cookie(fgetline, cookie) + char_u *(*fgetline) __ARGS((int, void *, int)); + void *cookie; /* argument for fgetline() */ { # ifdef FEAT_EVAL char_u *(*gp) __ARGS((int, void *, int)); struct loop_cookie *cp; - /* When "getline" is "get_loop_line()" use the "cookie" to find the + /* When "fgetline" is "get_loop_line()" use the "cookie" to find the * cookie that's orignally used to obtain the lines. This may be nested * several levels. */ - gp = getline; + gp = fgetline; cp = (struct loop_cookie *)cookie; while (gp == get_loop_line) { @@ -1648,7 +1651,7 @@ getline_cookie(getline, cookie) * 5. parse arguments * 6. switch on command name * - * Note: "getline" can be NULL. + * Note: "fgetline" can be NULL. * * This function may be called recursively! */ @@ -1663,14 +1666,14 @@ do_one_cmd(cmdlinep, sourcing, #ifdef FEAT_EVAL cstack, #endif - getline, cookie) + fgetline, cookie) char_u **cmdlinep; int sourcing; #ifdef FEAT_EVAL struct condstack *cstack; #endif - char_u *(*getline) __ARGS((int, void *, int)); - void *cookie; /* argument for getline() */ + char_u *(*fgetline) __ARGS((int, void *, int)); + void *cookie; /* argument for fgetline() */ { char_u *p; linenr_T lnum; @@ -1698,7 +1701,7 @@ do_one_cmd(cmdlinep, sourcing, if (quitmore #ifdef FEAT_EVAL /* avoid that a function call in 'statusline' does this */ - && !getline_equal(getline, cookie, get_func_line) + && !getline_equal(fgetline, cookie, get_func_line) #endif ) --quitmore; @@ -1728,8 +1731,8 @@ do_one_cmd(cmdlinep, sourcing, /* in ex mode, an empty line works like :+ */ if (*ea.cmd == NUL && exmode_active - && (getline_equal(getline, cookie, getexmodeline) - || getline_equal(getline, cookie, getexline)) + && (getline_equal(fgetline, cookie, getexmodeline) + || getline_equal(fgetline, cookie, getexline)) && curwin->w_cursor.lnum < curbuf->b_ml.ml_line_count) { ea.cmd = (char_u *)"+"; @@ -1918,9 +1921,9 @@ do_one_cmd(cmdlinep, sourcing, /* Count this line for profiling if ea.skip is FALSE. */ if (do_profiling == PROF_YES && !ea.skip) { - if (getline_equal(getline, cookie, get_func_line)) - func_line_exec(getline_cookie(getline, cookie)); - else if (getline_equal(getline, cookie, getsourceline)) + if (getline_equal(fgetline, cookie, get_func_line)) + func_line_exec(getline_cookie(fgetline, cookie)); + else if (getline_equal(fgetline, cookie, getsourceline)) script_line_exec(); } #endif @@ -2589,7 +2592,7 @@ do_one_cmd(cmdlinep, sourcing, * The "ea" structure holds the arguments that can be used. */ ea.cmdlinep = cmdlinep; - ea.getline = getline; + ea.getline = fgetline; ea.cookie = cookie; #ifdef FEAT_EVAL ea.cstack = cstack; @@ -2627,9 +2630,9 @@ do_one_cmd(cmdlinep, sourcing, do_throw(cstack); else if (check_cstack) { - if (source_finished(getline, cookie)) + if (source_finished(fgetline, cookie)) do_finish(&ea, TRUE); - else if (getline_equal(getline, cookie, get_func_line) + else if (getline_equal(fgetline, cookie, get_func_line) && current_func_returned()) do_return(&ea, TRUE, FALSE, NULL); } diff --git a/src/gui_beval.c b/src/gui_beval.c --- a/src/gui_beval.c +++ b/src/gui_beval.c @@ -926,7 +926,7 @@ requestBalloon(beval) # define IS_NONPRINTABLE(c) (((c) < 0x20 && (c) != TAB && (c) != NL) \ || (c) == DEL) static void -set_printable_label_text(GtkLabel *label, char_u *msg) +set_printable_label_text(GtkLabel *label, char_u *text) { char_u *convbuf = NULL; char_u *buf; @@ -940,14 +940,14 @@ set_printable_label_text(GtkLabel *label /* Convert to UTF-8 if it isn't already */ if (output_conv.vc_type != CONV_NONE) { - convbuf = string_convert(&output_conv, msg, NULL); + convbuf = string_convert(&output_conv, text, NULL); if (convbuf != NULL) - msg = convbuf; + text = convbuf; } /* First let's see how much we need to allocate */ len = 0; - for (p = msg; *p != NUL; p += charlen) + for (p = text; *p != NUL; p += charlen) { if ((*p & 0x80) == 0) /* be quick for ASCII */ { @@ -992,7 +992,7 @@ set_printable_label_text(GtkLabel *label (unsigned long)pixel, &color); pdest = buf; - p = msg; + p = text; while (*p != NUL) { /* Be quick for ASCII */ diff --git a/src/gui_gtk.c b/src/gui_gtk.c --- a/src/gui_gtk.c +++ b/src/gui_gtk.c @@ -957,15 +957,15 @@ toolbar_remove_item_by_text(GtkToolbar * get_menu_position(vimmenu_T *menu) { vimmenu_T *node; - int index = 0; + int idx = 0; for (node = menu->parent->children; node != menu; node = node->next) { g_return_val_if_fail(node != NULL, -1); - ++index; + ++idx; } - return index; + return idx; } #endif /* FEAT_TOOLBAR && HAVE_GTK2 */ @@ -2127,7 +2127,7 @@ dialog_add_buttons(GtkDialog *dialog, ch char **ync; /* "yes no cancel" */ char **buttons; int n_buttons = 0; - int index; + int idx; button_string = vim_strsave(button_string); /* must be writable */ if (button_string == NULL) @@ -2161,12 +2161,12 @@ dialog_add_buttons(GtkDialog *dialog, ch * Well, apparently somebody changed his mind: with GTK 2.2.4 it works the * other way around... */ - for (index = 1; index <= n_buttons; ++index) + for (idx = 1; idx <= n_buttons; ++idx) { char *label; char_u *label8; - label = buttons[index - 1]; + label = buttons[idx - 1]; /* * Perform some guesswork to find appropriate stock items for the * buttons. We have to compare with a sample of the translated @@ -2188,7 +2188,7 @@ dialog_add_buttons(GtkDialog *dialog, ch else if (button_equal(label, "Cancel")) label = GTK_STOCK_CANCEL; } label8 = CONVERT_TO_UTF8((char_u *)label); - gtk_dialog_add_button(dialog, (const gchar *)label8, index); + gtk_dialog_add_button(dialog, (const gchar *)label8, idx); CONVERT_TO_UTF8_FREE(label8); } diff --git a/src/gui_gtk_x11.c b/src/gui_gtk_x11.c --- a/src/gui_gtk_x11.c +++ b/src/gui_gtk_x11.c @@ -3233,12 +3233,12 @@ on_tabline_menu(GtkWidget *widget, GdkEv on_select_tab( GtkNotebook *notebook, GtkNotebookPage *page, - gint index, + gint idx, gpointer data) { if (!ignore_tabline_evt) { - if (send_tabline_event(index + 1) && gtk_main_level() > 0) + if (send_tabline_event(idx + 1) && gtk_main_level() > 0) gtk_main_quit(); } } @@ -5303,13 +5303,13 @@ gui_mch_get_fontname(GuiFont font, char_ # ifdef HAVE_GTK2 if (font != NOFONT) { - char *name = pango_font_description_to_string(font); - - if (name != NULL) + char *pangoname = pango_font_description_to_string(font); + + if (pangoname != NULL) { - char_u *s = vim_strsave((char_u *)name); - - g_free(name); + char_u *s = vim_strsave((char_u *)pangoname); + + g_free(pangoname); return s; } } @@ -6241,24 +6241,20 @@ gui_mch_invert_rectangle(int r, int c, i { GdkGCValues values; GdkGC *invert_gc; - GdkColor foreground; - GdkColor background; if (gui.drawarea->window == NULL) return; - foreground.pixel = gui.norm_pixel ^ gui.back_pixel; - background.pixel = gui.norm_pixel ^ gui.back_pixel; - - values.foreground = foreground; - values.background = background; + values.foreground.pixel = gui.norm_pixel ^ gui.back_pixel; + values.background.pixel = gui.norm_pixel ^ gui.back_pixel; values.function = GDK_XOR; invert_gc = gdk_gc_new_with_values(gui.drawarea->window, &values, GDK_GC_FOREGROUND | GDK_GC_BACKGROUND | GDK_GC_FUNCTION); - gdk_gc_set_exposures(invert_gc, gui.visibility != GDK_VISIBILITY_UNOBSCURED); + gdk_gc_set_exposures(invert_gc, gui.visibility != + GDK_VISIBILITY_UNOBSCURED); gdk_draw_rectangle(gui.drawarea->window, invert_gc, TRUE, FILL_X(c), FILL_Y(r), diff --git a/src/hardcopy.c b/src/hardcopy.c --- a/src/hardcopy.c +++ b/src/hardcopy.c @@ -1794,29 +1794,27 @@ static struct prt_resfile_buffer_S prt_r static int prt_resfile_next_line() { - int index; + int idx; /* Move to start of next line and then find end of line */ - index = prt_resfile.line_end + 1; - while (index < prt_resfile.len) + idx = prt_resfile.line_end + 1; + while (idx < prt_resfile.len) { - if (prt_resfile.buffer[index] != PSLF && prt_resfile.buffer[index] - != PSCR) + if (prt_resfile.buffer[idx] != PSLF && prt_resfile.buffer[idx] != PSCR) break; - index++; + idx++; } - prt_resfile.line_start = index; - - while (index < prt_resfile.len) + prt_resfile.line_start = idx; + + while (idx < prt_resfile.len) { - if (prt_resfile.buffer[index] == PSLF || prt_resfile.buffer[index] - == PSCR) + if (prt_resfile.buffer[idx] == PSLF || prt_resfile.buffer[idx] == PSCR) break; - index++; + idx++; } - prt_resfile.line_end = index; - - return (index < prt_resfile.len); + prt_resfile.line_end = idx; + + return (idx < prt_resfile.len); } static int @@ -1837,14 +1835,14 @@ prt_resfile_strncmp(offset, string, len) prt_resfile_skip_nonws(offset) int offset; { - int index; - - index = prt_resfile.line_start + offset; - while (index < prt_resfile.line_end) + int idx; + + idx = prt_resfile.line_start + offset; + while (idx < prt_resfile.line_end) { - if (isspace(prt_resfile.buffer[index])) - return index - prt_resfile.line_start; - index++; + if (isspace(prt_resfile.buffer[idx])) + return idx - prt_resfile.line_start; + idx++; } return -1; } @@ -1853,14 +1851,14 @@ prt_resfile_skip_nonws(offset) prt_resfile_skip_ws(offset) int offset; { - int index; - - index = prt_resfile.line_start + offset; - while (index < prt_resfile.line_end) + int idx; + + idx = prt_resfile.line_start + offset; + while (idx < prt_resfile.line_end) { - if (!isspace(prt_resfile.buffer[index])) - return index - prt_resfile.line_start; - index++; + if (!isspace(prt_resfile.buffer[idx])) + return idx - prt_resfile.line_start; + idx++; } return -1; } @@ -2478,7 +2476,7 @@ mch_print_init(psettings, jobname, force char_u *p_encoding; struct prt_ps_encoding_S *p_mbenc; struct prt_ps_encoding_S *p_mbenc_first; - struct prt_ps_charset_S *p_mbchar; + struct prt_ps_charset_S *p_mbchar = NULL; #endif #if 0 @@ -2516,7 +2514,6 @@ mch_print_init(psettings, jobname, force if (!(props & ENC_8BIT) && ((*p_pmcs != NUL) || !(props & ENC_UNICODE))) { p_mbenc_first = NULL; - p_mbchar = NULL; for (cmap = 0; cmap < NUM_ELEMENTS(prt_ps_mbfonts); cmap++) if (prt_match_encoding((char *)p_encoding, &prt_ps_mbfonts[cmap], &p_mbenc)) diff --git a/src/if_cscope.c b/src/if_cscope.c --- a/src/if_cscope.c +++ b/src/if_cscope.c @@ -989,8 +989,7 @@ cs_find_common(opt, pat, forceit, verbos { int i; char *cmd; - char **matches, **contexts; - int nummatches[CSCOPE_MAX_CONNECTIONS], totmatches, matched; + int nummatches[CSCOPE_MAX_CONNECTIONS], totmatches; #ifdef FEAT_QUICKFIX char cmdletter; char *qfpos; @@ -1141,6 +1140,9 @@ cs_find_common(opt, pat, forceit, verbos else #endif /* FEAT_QUICKFIX */ { + char **matches = NULL, **contexts = NULL; + int matched = 0; + /* read output */ cs_fill_results((char *)pat, totmatches, nummatches, &matches, &contexts, &matched); diff --git a/src/main.c b/src/main.c --- a/src/main.c +++ b/src/main.c @@ -2285,7 +2285,7 @@ create_windows(parmp) mparm_T *parmp; { #ifdef FEAT_WINDOWS - int rewind; + int dorewind; int done = 0; /* @@ -2342,10 +2342,10 @@ create_windows(parmp) ++autocmd_no_leave; #endif #ifdef FEAT_WINDOWS - rewind = TRUE; + dorewind = TRUE; while (done++ < 1000) { - if (rewind) + if (dorewind) { if (parmp->window_layout == WIN_TABS) goto_tabpage(1); @@ -2364,7 +2364,7 @@ create_windows(parmp) break; curwin = curwin->w_next; } - rewind = FALSE; + dorewind = FALSE; #endif curbuf = curwin->w_buffer; if (curbuf->b_ml.ml_mfp == NULL) @@ -2385,7 +2385,7 @@ create_windows(parmp) check_swap_exists_action(); #endif #ifdef FEAT_AUTOCMD - rewind = TRUE; /* start again */ + dorewind = TRUE; /* start again */ #endif } #ifdef FEAT_WINDOWS diff --git a/src/mbyte.c b/src/mbyte.c --- a/src/mbyte.c +++ b/src/mbyte.c @@ -3861,13 +3861,13 @@ im_get_feedback_attr(int col) if (preedit_string != NULL && attr_list != NULL) { - int index; + int idx; /* Get the byte index as used by PangoAttrIterator */ - for (index = 0; col > 0 && preedit_string[index] != '\0'; --col) - index += utfc_ptr2len((char_u *)preedit_string + index); - - if (preedit_string[index] != '\0') + for (idx = 0; col > 0 && preedit_string[idx] != '\0'; --col) + idx += utfc_ptr2len((char_u *)preedit_string + idx); + + if (preedit_string[idx] != '\0') { PangoAttrIterator *iter; int start, end; @@ -3880,7 +3880,7 @@ im_get_feedback_attr(int col) { pango_attr_iterator_range(iter, &start, &end); - if (index >= start && index < end) + if (idx >= start && idx < end) char_attr |= translate_pango_attributes(iter); } while (pango_attr_iterator_next(iter)); diff --git a/src/memline.c b/src/memline.c --- a/src/memline.c +++ b/src/memline.c @@ -215,7 +215,7 @@ static linenr_T lowest_marked = 0; #define ML_FLUSH 0x02 /* flush locked block */ #define ML_SIMPLE(x) (x & 0x10) /* DEL, INS or FIND */ -static void ml_upd_block0 __ARGS((buf_T *buf, int setfname)); +static void ml_upd_block0 __ARGS((buf_T *buf, int set_fname)); static void set_b0_fname __ARGS((ZERO_BL *, buf_T *buf)); static void set_b0_dir_flag __ARGS((ZERO_BL *b0p, buf_T *buf)); #ifdef FEAT_MBYTE @@ -679,9 +679,9 @@ ml_timestamp(buf) * Update the timestamp or the B0_SAME_DIR flag of the .swp file. */ static void -ml_upd_block0(buf, setfname) +ml_upd_block0(buf, set_fname) buf_T *buf; - int setfname; + int set_fname; { memfile_T *mfp; bhdr_T *hp; @@ -695,7 +695,7 @@ ml_upd_block0(buf, setfname) EMSG(_("E304: ml_upd_block0(): Didn't get block 0??")); else { - if (setfname) + if (set_fname) set_b0_fname(b0p, buf); else set_b0_dir_flag(b0p, buf); diff --git a/src/netbeans.c b/src/netbeans.c --- a/src/netbeans.c +++ b/src/netbeans.c @@ -103,7 +103,7 @@ static gint inputHandler; /* Cookie for static int inputHandler = -1; /* simply ret.value of WSAAsyncSelect() */ extern HWND s_hwnd; /* Gvim's Window handle */ #endif -static int cmdno; /* current command number for reply */ +static int r_cmdno; /* current command number for reply */ static int haveConnection = FALSE; /* socket is connected and initialization is done */ #ifdef FEAT_GUI_MOTIF @@ -832,11 +832,11 @@ nb_parse_cmd(char_u *cmd) return; } - cmdno = strtol(q, &q, 10); + r_cmdno = strtol(q, &q, 10); q = (char *)skipwhite((char_u *)q); - if (nb_do_cmd(bufno, (char_u *)verb, isfunc, cmdno, (char_u *)q) == FAIL) + if (nb_do_cmd(bufno, (char_u *)verb, isfunc, r_cmdno, (char_u *)q) == FAIL) { #ifdef NBDEBUG /* @@ -1008,11 +1008,11 @@ netbeans_end(void) if (netbeansForcedQuit) { /* mark as unmodified so NetBeans won't put up dialog on "killed" */ - sprintf(buf, "%d:unmodified=%d\n", i, cmdno); + sprintf(buf, "%d:unmodified=%d\n", i, r_cmdno); nbdebug(("EVT: %s", buf)); nb_send(buf, "netbeans_end"); } - sprintf(buf, "%d:killed=%d\n", i, cmdno); + sprintf(buf, "%d:killed=%d\n", i, r_cmdno); nbdebug(("EVT: %s", buf)); /* nb_send(buf, "netbeans_end"); avoid "write failed" messages */ if (sd >= 0) @@ -2563,7 +2563,7 @@ netbeans_beval_cb( if (p != NULL) { vim_snprintf(buf, sizeof(buf), - "0:balloonText=%d \"%s\"\n", cmdno, p); + "0:balloonText=%d \"%s\"\n", r_cmdno, p); vim_free(p); } nbdebug(("EVT: %s", buf)); @@ -2617,7 +2617,7 @@ netbeans_send_disconnect() if (haveConnection) { - sprintf(buf, "0:disconnect=%d\n", cmdno); + sprintf(buf, "0:disconnect=%d\n", r_cmdno); nbdebug(("EVT: %s", buf)); nb_send(buf, "netbeans_disconnect"); } @@ -2636,7 +2636,7 @@ netbeans_frame_moved(int new_x, int new_ return; sprintf(buf, "0:geometry=%d %d %d %d %d\n", - cmdno, (int)Columns, (int)Rows, new_x, new_y); + r_cmdno, (int)Columns, (int)Rows, new_x, new_y); /*nbdebug(("EVT: %s", buf)); happens too many times during a move */ nb_send(buf, "netbeans_frame_moved"); } @@ -2745,7 +2745,7 @@ netbeans_file_closed(buf_T *bufp) if (bufno <= 0) return; - sprintf(buffer, "%d:killed=%d\n", bufno, cmdno); + sprintf(buffer, "%d:killed=%d\n", bufno, r_cmdno); nbdebug(("EVT: %s", buffer)); @@ -2819,7 +2819,8 @@ netbeans_inserted( if (p != NULL) { buf = alloc(128 + 2*newlen); - sprintf((char *)buf, "%d:insert=%d %ld \"%s\"\n", bufno, cmdno, off, p); + sprintf((char *)buf, "%d:insert=%d %ld \"%s\"\n", + bufno, r_cmdno, off, p); nbdebug(("EVT: %s", buf)); nb_send((char *)buf, "netbeans_inserted"); vim_free(p); @@ -2861,7 +2862,7 @@ netbeans_removed( off = pos2off(bufp, &pos); - sprintf((char *)buf, "%d:remove=%d %ld %ld\n", bufno, cmdno, off, len); + sprintf((char *)buf, "%d:remove=%d %ld %ld\n", bufno, r_cmdno, off, len); nbdebug(("EVT: %s", buf)); nb_send((char *)buf, "netbeans_removed"); } @@ -2886,7 +2887,7 @@ netbeans_unmodified(buf_T *bufp) nbbuf->modified = 0; - sprintf((char *)buf, "%d:unmodified=%d\n", bufno, cmdno); + sprintf((char *)buf, "%d:unmodified=%d\n", bufno, r_cmdno); nbdebug(("EVT: %s", buf)); nb_send((char *)buf, "netbeans_unmodified"); #endif @@ -2910,11 +2911,11 @@ netbeans_button_release(int button) long off = pos2off(curbuf, &curwin->w_cursor); /* sync the cursor position */ - sprintf(buf, "%d:newDotAndMark=%d %ld %ld\n", bufno, cmdno, off, off); + sprintf(buf, "%d:newDotAndMark=%d %ld %ld\n", bufno, r_cmdno, off, off); nbdebug(("EVT: %s", buf)); nb_send(buf, "netbeans_button_release[newDotAndMark]"); - sprintf(buf, "%d:buttonRelease=%d %d %ld %d\n", bufno, cmdno, + sprintf(buf, "%d:buttonRelease=%d %d %ld %d\n", bufno, r_cmdno, button, (long)curwin->w_cursor.lnum, col); nbdebug(("EVT: %s", buf)); nb_send(buf, "netbeans_button_release"); @@ -2975,7 +2976,7 @@ netbeans_keystring(int key, char *keyNam /* sync the cursor position */ off = pos2off(curbuf, &curwin->w_cursor); - sprintf(buf, "%d:newDotAndMark=%d %ld %ld\n", bufno, cmdno, off, off); + sprintf(buf, "%d:newDotAndMark=%d %ld %ld\n", bufno, r_cmdno, off, off); nbdebug(("EVT: %s", buf)); nb_send(buf, "netbeans_keycommand"); @@ -2986,13 +2987,13 @@ netbeans_keystring(int key, char *keyNam /* now send keyCommand event */ vim_snprintf(buf, sizeof(buf), "%d:keyCommand=%d \"%s\"\n", - bufno, cmdno, keyName); + bufno, r_cmdno, keyName); nbdebug(("EVT: %s", buf)); nb_send(buf, "netbeans_keycommand"); /* New: do both at once and include the lnum/col. */ vim_snprintf(buf, sizeof(buf), "%d:keyAtPos=%d \"%s\" %ld %ld/%ld\n", - bufno, cmdno, keyName, + bufno, r_cmdno, keyName, off, (long)curwin->w_cursor.lnum, (long)curwin->w_cursor.col); nbdebug(("EVT: %s", buf)); nb_send(buf, "netbeans_keycommand"); @@ -3015,7 +3016,7 @@ netbeans_save_buffer(buf_T *bufp) nbbuf->modified = 0; - sprintf((char *)buf, "%d:save=%d\n", bufno, cmdno); + sprintf((char *)buf, "%d:save=%d\n", bufno, r_cmdno); nbdebug(("EVT: %s", buf)); nb_send((char *)buf, "netbeans_save_buffer"); } @@ -3039,7 +3040,7 @@ netbeans_deleted_all_lines(buf_T *bufp) if (nbbuf->insertDone) nbbuf->modified = 1; - sprintf((char *)buf, "%d:remove=%d 0 -1\n", bufno, cmdno); + sprintf((char *)buf, "%d:remove=%d 0 -1\n", bufno, r_cmdno); nbdebug(("EVT(suppressed): %s", buf)); /* nb_send(buf, "netbeans_deleted_all_lines"); */ } diff --git a/src/normal.c b/src/normal.c --- a/src/normal.c +++ b/src/normal.c @@ -4127,7 +4127,7 @@ find_decl(ptr, len, locally, thisblock, int save_p_ws; int save_p_scs; int retval = OK; - int incl; + int incll; if ((pat = alloc(len + 7)) == NULL) return FAIL; @@ -4147,7 +4147,7 @@ find_decl(ptr, len, locally, thisblock, * With "gd" Search back for the start of the current function, then go * back until a blank line. If this fails go to line 1. */ - if (!locally || !findpar(&incl, BACKWARD, 1L, '{', FALSE)) + if (!locally || !findpar(&incll, BACKWARD, 1L, '{', FALSE)) { setpcmark(); /* Set in findpar() otherwise */ curwin->w_cursor.lnum = 1; diff --git a/src/option.c b/src/option.c --- a/src/option.c +++ b/src/option.c @@ -5268,45 +5268,46 @@ set_string_option_direct(name, opt_idx, char_u *s; char_u **varp; int both = (opt_flags & (OPT_LOCAL | OPT_GLOBAL)) == 0; - - if (opt_idx == -1) /* use name */ - { - opt_idx = findoption(name); - if (opt_idx < 0) /* not found (should not happen) */ + int idx = opt_idx; + + if (idx == -1) /* use name */ + { + idx = findoption(name); + if (idx < 0) /* not found (should not happen) */ { EMSG2(_(e_intern2), "set_string_option_direct()"); return; } } - if (options[opt_idx].var == NULL) /* can't set hidden option */ + if (options[idx].var == NULL) /* can't set hidden option */ return; s = vim_strsave(val); if (s != NULL) { - varp = (char_u **)get_varp_scope(&(options[opt_idx]), + varp = (char_u **)get_varp_scope(&(options[idx]), both ? OPT_LOCAL : opt_flags); - if ((opt_flags & OPT_FREE) && (options[opt_idx].flags & P_ALLOCED)) + if ((opt_flags & OPT_FREE) && (options[idx].flags & P_ALLOCED)) free_string_option(*varp); *varp = s; /* For buffer/window local option may also set the global value. */ if (both) - set_string_option_global(opt_idx, varp); - - options[opt_idx].flags |= P_ALLOCED; + set_string_option_global(idx, varp); + + options[idx].flags |= P_ALLOCED; /* When setting both values of a global option with a local value, * make the local value empty, so that the global value is used. */ - if (((int)options[opt_idx].indir & PV_BOTH) && both) + if (((int)options[idx].indir & PV_BOTH) && both) { free_string_option(*varp); *varp = empty_option; } # ifdef FEAT_EVAL if (set_sid != SID_NONE) - set_option_scriptID_idx(opt_idx, opt_flags, + set_option_scriptID_idx(idx, opt_flags, set_sid == 0 ? current_SID : set_sid); # endif } diff --git a/src/os_unix.c b/src/os_unix.c --- a/src/os_unix.c +++ b/src/os_unix.c @@ -3934,7 +3934,7 @@ mch_call_shell(cmd, options) { linenr_T lnum = curbuf->b_op_start.lnum; int written = 0; - char_u *p = ml_get(lnum); + char_u *lp = ml_get(lnum); char_u *s; size_t l; @@ -3942,17 +3942,17 @@ mch_call_shell(cmd, options) close(fromshell_fd); for (;;) { - l = STRLEN(p + written); + l = STRLEN(lp + written); if (l == 0) len = 0; - else if (p[written] == NL) + else if (lp[written] == NL) /* NL -> NUL translation */ len = write(toshell_fd, "", (size_t)1); else { - s = vim_strchr(p + written, NL); - len = write(toshell_fd, (char *)p + written, - s == NULL ? l : s - (p + written)); + s = vim_strchr(lp + written, NL); + len = write(toshell_fd, (char *)lp + written, + s == NULL ? l : s - (lp + written)); } if (len == l) { @@ -3973,7 +3973,7 @@ mch_call_shell(cmd, options) toshell_fd = -1; break; } - p = ml_get(lnum); + lp = ml_get(lnum); written = 0; } else if (len > 0) diff --git a/src/quickfix.c b/src/quickfix.c --- a/src/quickfix.c +++ b/src/quickfix.c @@ -500,8 +500,6 @@ qf_init_ext(qi, efile, buf, tv, errorfor { if (tv != NULL) { - int len; - if (tv->v_type == VAR_STRING) { /* Get the next line from the supplied string */ diff --git a/src/regexp.c b/src/regexp.c --- a/src/regexp.c +++ b/src/regexp.c @@ -3912,7 +3912,7 @@ regmatch(scan) { colnr_T start, end; colnr_T start2, end2; - colnr_T col; + colnr_T cols; getvvcol(wp, &top, &start, NULL, &end); getvvcol(wp, &bot, &start2, NULL, &end2); @@ -3922,9 +3922,9 @@ regmatch(scan) end = end2; if (top.col == MAXCOL || bot.col == MAXCOL) end = MAXCOL; - col = win_linetabsize(wp, + cols = win_linetabsize(wp, regline, (colnr_T)(reginput - regline)); - if (col < start || col > end - (*p_sel == 'e')) + if (cols < start || cols > end - (*p_sel == 'e')) status = RA_NOMATCH; } } @@ -4253,7 +4253,7 @@ regmatch(scan) { int i, len; char_u *opnd; - int opndc, inpc; + int opndc = 0, inpc; opnd = OPERAND(scan); /* Safety check (just in case 'encoding' was changed since diff --git a/src/screen.c b/src/screen.c --- a/src/screen.c +++ b/src/screen.c @@ -7099,7 +7099,7 @@ screenalloc(clear) tabpage_T *tp; #endif static int entered = FALSE; /* avoid recursiveness */ - static int did_outofmem_msg = FALSE; /* did outofmem message */ + static int done_outofmem_msg = FALSE; /* did outofmem message */ /* * Allocation of the screen buffers is done only when the size changes and @@ -7207,14 +7207,14 @@ screenalloc(clear) #endif || outofmem) { - if (ScreenLines != NULL || !did_outofmem_msg) + if (ScreenLines != NULL || !done_outofmem_msg) { /* guess the size */ do_outofmem_msg((long_u)((Rows + 1) * Columns)); /* Remember we did this to avoid getting outofmem messages over * and over again. */ - did_outofmem_msg = TRUE; + done_outofmem_msg = TRUE; } vim_free(new_ScreenLines); new_ScreenLines = NULL; @@ -7242,7 +7242,7 @@ screenalloc(clear) } else { - did_outofmem_msg = FALSE; + done_outofmem_msg = FALSE; for (new_row = 0; new_row < Rows; ++new_row) { diff --git a/src/search.c b/src/search.c --- a/src/search.c +++ b/src/search.c @@ -4826,15 +4826,20 @@ search_line: if ((compl_cont_status & CONT_ADDING) && i == compl_length) { - /* get the next line */ /* IOSIZE > compl_length, so the STRNCPY works */ STRNCPY(IObuff, aux, i); - if (!( depth < 0 - && lnum < end_lnum - && (line = ml_get(++lnum)) != NULL) - && !( depth >= 0 - && !vim_fgets(line = file_line, - LSIZE, files[depth].fp))) + + /* Get the next line: when "depth" < 0 from the current + * buffer, otherwise from the included file. Jump to + * exit_matched when past the last line. */ + if (depth < 0) + { + if (lnum >= end_lnum) + goto exit_matched; + line = ml_get(++lnum); + } + else if (vim_fgets(line = file_line, + LSIZE, files[depth].fp)) goto exit_matched; /* we read a line, set "already" to check this "line" later diff --git a/src/spell.c b/src/spell.c --- a/src/spell.c +++ b/src/spell.c @@ -2043,8 +2043,8 @@ spell_move_to(wp, dir, allwords, curline int len; # ifdef FEAT_SYN_HL int has_syntax = syntax_present(wp->w_buffer); +# endif int col; -# endif int can_spell; char_u *buf = NULL; int buflen = 0; @@ -2093,9 +2093,8 @@ spell_move_to(wp, dir, allwords, curline capcol = (int)(skipwhite(line) - line); else if (curline && wp == curwin) { - int col = (int)(skipwhite(line) - line); - /* For spellbadword(): check if first word needs a capital. */ + col = (int)(skipwhite(line) - line); if (check_need_cap(lnum, col)) capcol = col; @@ -5061,7 +5060,7 @@ spell_read_aff(spin, fname) int do_rep; int do_repsal; int do_sal; - int do_map; + int do_mapline; int found_map = FALSE; hashitem_T *hi; int l; @@ -5099,7 +5098,7 @@ spell_read_aff(spin, fname) do_sal = spin->si_sal.ga_len == 0; /* Only do MAP lines when not done in another .aff file already. */ - do_map = spin->si_map.ga_len == 0; + do_mapline = spin->si_map.ga_len == 0; /* * Allocate and init the afffile_T structure. @@ -5781,7 +5780,7 @@ spell_read_aff(spin, fname) smsg((char_u *)_("Expected MAP count in %s line %d"), fname, lnum); } - else if (do_map) + else if (do_mapline) { int c; @@ -7508,7 +7507,7 @@ spell_check_msm() { char_u *p = p_msm; long start = 0; - long inc = 0; + long incr = 0; long added = 0; if (!VIM_ISDIGIT(*p)) @@ -7520,7 +7519,7 @@ spell_check_msm() ++p; if (!VIM_ISDIGIT(*p)) return FAIL; - inc = (getdigits(&p) * 102) / (SBLOCKSIZE / 10); + incr = (getdigits(&p) * 102) / (SBLOCKSIZE / 10); if (*p != ',') return FAIL; ++p; @@ -7530,11 +7529,11 @@ spell_check_msm() if (*p != NUL) return FAIL; - if (start == 0 || inc == 0 || added == 0 || inc > start) + if (start == 0 || incr == 0 || added == 0 || incr > start) return FAIL; compress_start = start; - compress_inc = inc; + compress_inc = incr; compress_added = added; return OK; } @@ -8292,14 +8291,14 @@ clear_node(node) * Returns the number of nodes used. */ static int -put_node(fd, node, index, regionmask, prefixtree) +put_node(fd, node, idx, regionmask, prefixtree) FILE *fd; /* NULL when only counting */ wordnode_T *node; - int index; + int idx; int regionmask; int prefixtree; /* TRUE for PREFIXTREE */ { - int newindex = index; + int newindex = idx; int siblingcount = 0; wordnode_T *np; int flags; @@ -8309,7 +8308,7 @@ put_node(fd, node, index, regionmask, pr return 0; /* Store the index where this node is written. */ - node->wn_u1.index = index; + node->wn_u1.index = idx; /* Count the number of siblings. */ for (np = node; np != NULL; np = np->wn_sibling) @@ -9244,11 +9243,11 @@ ex_spell(eap) * Add "word[len]" to 'spellfile' as a good or bad word. */ void -spell_add_word(word, len, bad, index, undo) +spell_add_word(word, len, bad, idx, undo) char_u *word; int len; int bad; - int index; /* "zG" and "zW": zero, otherwise index in + int idx; /* "zG" and "zW": zero, otherwise index in 'spellfile' */ int undo; /* TRUE for "zug", "zuG", "zuw" and "zuW" */ { @@ -9262,7 +9261,7 @@ spell_add_word(word, len, bad, index, un int i; char_u *spf; - if (index == 0) /* use internal wordlist */ + if (idx == 0) /* use internal wordlist */ { if (int_wordlist == NULL) { @@ -9290,11 +9289,11 @@ spell_add_word(word, len, bad, index, un for (spf = curbuf->b_p_spf, i = 1; *spf != NUL; ++i) { copy_option_part(&spf, fnamebuf, MAXPATHL, ","); - if (i == index) + if (i == idx) break; if (*spf == NUL) { - EMSGN(_("E765: 'spellfile' does not have %ld entries"), index); + EMSGN(_("E765: 'spellfile' does not have %ld entries"), idx); return; } } @@ -13581,53 +13580,58 @@ add_suggestion(su, gap, goodword, badlen * the first "the" to itself. */ return; - /* Check if the word is already there. Also check the length that is - * being replaced "thes," -> "these" is a different suggestion from - * "thes" -> "these". */ - stp = &SUG(*gap, 0); - for (i = gap->ga_len; --i >= 0; ++stp) - if (stp->st_wordlen == goodlen - && stp->st_orglen == badlen - && STRNCMP(stp->st_word, goodword, goodlen) == 0) - { - /* - * Found it. Remember the word with the lowest score. - */ - if (stp->st_slang == NULL) - stp->st_slang = slang; - - new_sug.st_score = score; - new_sug.st_altscore = altscore; - new_sug.st_had_bonus = had_bonus; - - if (stp->st_had_bonus != had_bonus) - { - /* Only one of the two had the soundalike score computed. - * Need to do that for the other one now, otherwise the - * scores can't be compared. This happens because - * suggest_try_change() doesn't compute the soundalike - * word to keep it fast, while some special methods set - * the soundalike score to zero. */ - if (had_bonus) - rescore_one(su, stp); - else - { - new_sug.st_word = stp->st_word; - new_sug.st_wordlen = stp->st_wordlen; - new_sug.st_slang = stp->st_slang; - new_sug.st_orglen = badlen; - rescore_one(su, &new_sug); - } - } - - if (stp->st_score > new_sug.st_score) - { - stp->st_score = new_sug.st_score; - stp->st_altscore = new_sug.st_altscore; - stp->st_had_bonus = new_sug.st_had_bonus; - } - break; - } + if (gap->ga_len == 0) + i = -1; + else + { + /* Check if the word is already there. Also check the length that is + * being replaced "thes," -> "these" is a different suggestion from + * "thes" -> "these". */ + stp = &SUG(*gap, 0); + for (i = gap->ga_len; --i >= 0; ++stp) + if (stp->st_wordlen == goodlen + && stp->st_orglen == badlen + && STRNCMP(stp->st_word, goodword, goodlen) == 0) + { + /* + * Found it. Remember the word with the lowest score. + */ + if (stp->st_slang == NULL) + stp->st_slang = slang; + + new_sug.st_score = score; + new_sug.st_altscore = altscore; + new_sug.st_had_bonus = had_bonus; + + if (stp->st_had_bonus != had_bonus) + { + /* Only one of the two had the soundalike score computed. + * Need to do that for the other one now, otherwise the + * scores can't be compared. This happens because + * suggest_try_change() doesn't compute the soundalike + * word to keep it fast, while some special methods set + * the soundalike score to zero. */ + if (had_bonus) + rescore_one(su, stp); + else + { + new_sug.st_word = stp->st_word; + new_sug.st_wordlen = stp->st_wordlen; + new_sug.st_slang = stp->st_slang; + new_sug.st_orglen = badlen; + rescore_one(su, &new_sug); + } + } + + if (stp->st_score > new_sug.st_score) + { + stp->st_score = new_sug.st_score; + stp->st_altscore = new_sug.st_altscore; + stp->st_had_bonus = new_sug.st_had_bonus; + } + break; + } + } if (i < 0 && ga_grow(gap, 1) == OK) { diff --git a/src/ui.c b/src/ui.c --- a/src/ui.c +++ b/src/ui.c @@ -1137,7 +1137,6 @@ clip_copy_modeless_selection(both) int len; #ifdef FEAT_MBYTE char_u *p; - int i; #endif int row1 = clip_star.start.lnum; int col1 = clip_star.start.col; @@ -1218,6 +1217,8 @@ clip_copy_modeless_selection(both) #ifdef FEAT_MBYTE if (enc_dbcs != 0) { + int i; + p = ScreenLines + LineOffset[row]; for (i = start_col; i < end_col; ++i) if (enc_dbcs == DBCS_JPNU && p[i] == 0x8e) diff --git a/src/undo.c b/src/undo.c --- a/src/undo.c +++ b/src/undo.c @@ -1187,7 +1187,7 @@ u_undo_end(did_undo, absolute) int did_undo; /* just did an undo */ int absolute; /* used ":undo N" */ { - char *msg; + char *msgstr; u_header_T *uhp; char_u msgbuf[80]; @@ -1205,20 +1205,20 @@ u_undo_end(did_undo, absolute) u_oldcount -= u_newcount; if (u_oldcount == -1) - msg = N_("more line"); + msgstr = N_("more line"); else if (u_oldcount < 0) - msg = N_("more lines"); + msgstr = N_("more lines"); else if (u_oldcount == 1) - msg = N_("line less"); + msgstr = N_("line less"); else if (u_oldcount > 1) - msg = N_("fewer lines"); + msgstr = N_("fewer lines"); else { u_oldcount = u_newcount; if (u_newcount == 1) - msg = N_("change"); + msgstr = N_("change"); else - msg = N_("changes"); + msgstr = N_("changes"); } if (curbuf->b_u_curhead != NULL) @@ -1244,7 +1244,7 @@ u_undo_end(did_undo, absolute) smsg((char_u *)_("%ld %s; %s #%ld %s"), u_oldcount < 0 ? -u_oldcount : u_oldcount, - _(msg), + _(msgstr), did_undo ? _("before") : _("after"), uhp == NULL ? 0L : uhp->uh_seq, msgbuf); diff --git a/src/version.c b/src/version.c --- a/src/version.c +++ b/src/version.c @@ -667,6 +667,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 70, +/**/ 69, /**/ 68, diff --git a/src/window.c b/src/window.c --- a/src/window.c +++ b/src/window.c @@ -340,10 +340,10 @@ newwindow: { tabpage_T *oldtab = curtab; tabpage_T *newtab; - win_T *wp = curwin; /* First create a new tab with the window, then go back to * the old tab and close the window there. */ + wp = curwin; if (win_new_tabpage((int)Prenum) == OK && valid_tabpage(oldtab)) {