# HG changeset patch # User Bram Moolenaar # Date 1263909596 -3600 # Node ID 85da0376313011aa957a9132df2686c9aba079d0 # Parent d433f43849ba1dd0006dbc4d794cda3502fc24af updated for version 7.2.333 Problem: Warnings from static code analysis. Solution: Small changes to various lines. (Dominique Pelle) diff --git a/src/buffer.c b/src/buffer.c --- a/src/buffer.c +++ b/src/buffer.c @@ -315,7 +315,7 @@ close_buffer(win, buf, action) { #ifdef FEAT_AUTOCMD int is_curbuf; - int nwindows = buf->b_nwindows; + int nwindows; #endif int unload_buf = (action != 0); int del_buf = (action == DOBUF_DEL || action == DOBUF_WIPE); diff --git a/src/edit.c b/src/edit.c --- a/src/edit.c +++ b/src/edit.c @@ -4048,7 +4048,7 @@ ins_compl_get_exp(ini) save_p_ic = p_ic; p_ic = ignorecase(compl_pattern); - /* Find up to TAG_MANY matches. Avoids that an enourmous number + /* Find up to TAG_MANY matches. Avoids that an enormous number * of matches is found when compl_pattern is empty */ if (find_tags(compl_pattern, &num_matches, &matches, TAG_REGEXP | TAG_NAMES | TAG_NOIC | @@ -4219,7 +4219,7 @@ ins_compl_get_exp(ini) || IObuff[len - 2] == '!')))) IObuff[len++] = ' '; } - /* copy as much as posible of the new word */ + /* copy as much as possible of the new word */ if (tmp_ptr - ptr >= IOSIZE - len) tmp_ptr = ptr + IOSIZE - len - 1; STRNCPY(IObuff + len, ptr, tmp_ptr - ptr); @@ -5827,10 +5827,7 @@ internal_format(textwidth, second_indent #endif && !has_format_option(FO_WRAP)) - { - textwidth = 0; break; - } if ((startcol = curwin->w_cursor.col) == 0) break; diff --git a/src/ex_getln.c b/src/ex_getln.c --- a/src/ex_getln.c +++ b/src/ex_getln.c @@ -2193,7 +2193,6 @@ getexmodeline(promptc, cookie, indent) { if (ga_grow(&line_ga, 40) == FAIL) break; - pend = (char_u *)line_ga.ga_data + line_ga.ga_len; /* Get one character at a time. Don't use inchar(), it can't handle * special characters. */ @@ -3314,7 +3313,7 @@ nextwild(xp, type, options) WILD_HOME_REPLACE|WILD_ADD_SLASH|WILD_SILENT|WILD_ESCAPE |options, type); vim_free(p1); - /* longest match: make sure it is not shorter (happens with :help */ + /* longest match: make sure it is not shorter, happens with :help */ if (p2 != NULL && type == WILD_LONGEST) { for (j = 0; j < xp->xp_pattern_len; ++j) diff --git a/src/fileio.c b/src/fileio.c --- a/src/fileio.c +++ b/src/fileio.c @@ -7072,8 +7072,8 @@ vim_tempname(extra_char) */ for (i = 0; i < (int)(sizeof(tempdirs) / sizeof(char *)); ++i) { +# ifndef HAVE_MKDTEMP size_t itmplen; -# ifndef HAVE_MKDTEMP long nr; long off; # endif @@ -7091,7 +7091,6 @@ vim_tempname(extra_char) else # endif add_pathsep(itmp); - itmplen = STRLEN(itmp); # ifdef HAVE_MKDTEMP /* Leave room for filename */ @@ -7104,6 +7103,7 @@ vim_tempname(extra_char) * otherwise it doesn't matter. The use of mkdir() avoids any * security problems because of the predictable number. */ nr = (mch_get_pid() + (long)time(NULL)) % 1000000L; + itmplen = STRLEN(itmp); /* Try up to 10000 different values until we find a name that * doesn't exist. */ diff --git a/src/if_cscope.c b/src/if_cscope.c --- a/src/if_cscope.c +++ b/src/if_cscope.c @@ -2069,7 +2069,7 @@ cs_print_tags_priv(matches, cntxts, num_ continue; (void)strcpy(tbuf, matches[idx]); - if ((fname = strtok(tbuf, (const char *)"\t")) == NULL) + if (strtok(tbuf, (const char *)"\t") == NULL) continue; if ((fname = strtok(NULL, (const char *)"\t")) == NULL) continue; diff --git a/src/netbeans.c b/src/netbeans.c --- a/src/netbeans.c +++ b/src/netbeans.c @@ -873,7 +873,7 @@ nb_parse_cmd(char_u *cmd) { #ifdef NBDEBUG /* - * This happens because the ExtEd can send a cammand or 2 after + * This happens because the ExtEd can send a command or 2 after * doing a stopDocumentListen command. It doesn't harm anything * so I'm disabling it except for debugging. */ @@ -1174,7 +1174,7 @@ nb_quote(char_u *txt) break; } } - *q++ = '\0'; + *q = '\0'; return buf; } @@ -3070,7 +3070,7 @@ netbeans_removed( } /* - * Send netbeans an unmodufied command. + * Send netbeans an unmodified command. */ void netbeans_unmodified(buf_T *bufp UNUSED) @@ -3366,7 +3366,7 @@ netbeans_gutter_click(linenr_T lnum) /* - * Add a sign of the reqested type at the requested location. + * Add a sign of the requested type at the requested location. * * Reverse engineering: * Apparently an annotation is defined the first time it is used in a buffer. diff --git a/src/ops.c b/src/ops.c --- a/src/ops.c +++ b/src/ops.c @@ -5591,13 +5591,13 @@ x11_export_final_selection() */ if (has_mbyte) { - char_u *conv_str = str; vimconv_T vc; vc.vc_type = CONV_NONE; if (convert_setup(&vc, p_enc, (char_u *)"latin1") == OK) { - int intlen = len; + int intlen = len; + char_u *conv_str; conv_str = string_convert(&vc, str, &intlen); len = intlen; diff --git a/src/quickfix.c b/src/quickfix.c --- a/src/quickfix.c +++ b/src/quickfix.c @@ -1899,7 +1899,6 @@ qf_list(eap) int i; int idx1 = 1; int idx2 = -1; - int need_return = TRUE; char_u *arg = eap->arg; int all = eap->forceit; /* if not :cl!, only show recognised errors */ @@ -1939,13 +1938,9 @@ qf_list(eap) { if ((qfp->qf_valid || all) && idx1 <= i && i <= idx2) { - if (need_return) - { - msg_putchar('\n'); - if (got_int) - break; - need_return = FALSE; - } + msg_putchar('\n'); + if (got_int) + break; fname = NULL; if (qfp->qf_fnum != 0 @@ -1988,7 +1983,6 @@ qf_list(eap) IObuff, IOSIZE); msg_prt_line(IObuff, FALSE); out_flush(); /* show one line at a time */ - need_return = TRUE; } qfp = qfp->qf_next; diff --git a/src/syntax.c b/src/syntax.c --- a/src/syntax.c +++ b/src/syntax.c @@ -4167,7 +4167,6 @@ clear_keywtab(ht) if (!HASHITEM_EMPTY(hi)) { --todo; - kp = HI2KE(hi); for (kp = HI2KE(hi); kp != NULL; kp = kp_next) { kp_next = kp->ke_next; diff --git a/src/ui.c b/src/ui.c --- a/src/ui.c +++ b/src/ui.c @@ -2383,7 +2383,7 @@ yank_cut_buffer0(dpy, cbd) * 'enc' anyway. */ if (has_mbyte) { - char_u *conv_buf = buffer; + char_u *conv_buf; vimconv_T vc; vc.vc_type = CONV_NONE; diff --git a/src/version.c b/src/version.c --- a/src/version.c +++ b/src/version.c @@ -682,6 +682,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 333, +/**/ 332, /**/ 331,