diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2019-12-26 07:02:44 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-12-26 07:02:44 +0100 |
commit | 927a4f24e09e879ae1006aab32ead81985c61865 (patch) | |
tree | 5e1ead3a895263522c061d9de733514a86476f41 | |
parent | 5f1aec5abdb551e5f3035ca054d36580b3233efb (diff) | |
parent | 234c4a846bc78b2cc119b72b994b3ac3f401c8c3 (diff) | |
download | rneovim-927a4f24e09e879ae1006aab32ead81985c61865.tar.gz rneovim-927a4f24e09e879ae1006aab32ead81985c61865.tar.bz2 rneovim-927a4f24e09e879ae1006aab32ead81985c61865.zip |
Merge #11612 from janlazo/clang-pvs
-rw-r--r-- | src/nvim/api/vim.c | 2 | ||||
-rw-r--r-- | src/nvim/ex_cmds.c | 22 | ||||
-rw-r--r-- | src/nvim/ex_docmd.c | 6 | ||||
-rw-r--r-- | src/nvim/ex_getln.c | 2 | ||||
-rw-r--r-- | src/nvim/hardcopy.c | 9 | ||||
-rw-r--r-- | src/nvim/lua/executor.c | 6 | ||||
-rw-r--r-- | src/nvim/misc1.c | 2 | ||||
-rw-r--r-- | src/nvim/mouse.c | 2 | ||||
-rw-r--r-- | src/nvim/ops.c | 11 | ||||
-rw-r--r-- | src/nvim/os/env.c | 4 | ||||
-rw-r--r-- | src/nvim/quickfix.c | 14 | ||||
-rw-r--r-- | src/nvim/search.c | 9 |
12 files changed, 38 insertions, 51 deletions
diff --git a/src/nvim/api/vim.c b/src/nvim/api/vim.c index 2f59edee33..661946e8d2 100644 --- a/src/nvim/api/vim.c +++ b/src/nvim/api/vim.c @@ -335,7 +335,7 @@ void nvim_input_mouse(String button, String action, String modifier, if (strequal(action.data, "down")) { code = KE_MOUSEUP; } else if (strequal(action.data, "up")) { - code = KE_MOUSEDOWN; + // code = KE_MOUSEDOWN } else if (strequal(action.data, "left")) { code = KE_MOUSERIGHT; } else if (strequal(action.data, "right")) { diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c index 0c3b467612..85048427b1 100644 --- a/src/nvim/ex_cmds.c +++ b/src/nvim/ex_cmds.c @@ -3249,7 +3249,6 @@ static void extmark_move_regmatch_single(lpos_T startpos, static void extmark_move_regmatch_multi(ExtmarkSubMulti s, long i) { colnr_T mincol; - linenr_T u_lnum; mincol = s.startpos.col + 1; linenr_T n_u_lnum = s.lnum + s.endpos.lnum - s.startpos.lnum; @@ -3266,7 +3265,7 @@ static void extmark_move_regmatch_multi(ExtmarkSubMulti s, long i) // -- Delete Pattern -- // 1. Move marks in the pattern mincol = s.startpos.col + 1; - u_lnum = n_u_lnum; + linenr_T u_lnum = n_u_lnum; assert(n_u_lnum == u_lnum); extmark_copy_and_place(curbuf, s.lnum, mincol, @@ -3311,7 +3310,6 @@ static void extmark_move_regmatch_multi(ExtmarkSubMulti s, long i) assert(s.startpos.lnum == 0); mincol = s.startpos.col + 1; - u_lnum = n_u_lnum; if (!s.newline_in_pat && s.newline_in_sub) { // -- Delete Pattern -- @@ -4947,17 +4945,21 @@ help_heuristic( * If the match is more than 2 chars from the start, multiply by 200 to * put it after matches at the start. */ - if (ASCII_ISALNUM(matched_string[offset]) && offset > 0 - && ASCII_ISALNUM(matched_string[offset - 1])) + if (offset > 0 + && ASCII_ISALNUM(matched_string[offset]) + && ASCII_ISALNUM(matched_string[offset - 1])) { offset += 10000; - else if (offset > 2) + } else if (offset > 2) { offset *= 200; - if (wrong_case) + } + if (wrong_case) { offset += 5000; - /* Features are less interesting than the subjects themselves, but "+" - * alone is not a feature. */ - if (matched_string[0] == '+' && matched_string[1] != NUL) + } + // Features are less interesting than the subjects themselves, but "+" + // alone is not a feature. + if (matched_string[0] == '+' && matched_string[1] != NUL) { offset += 100; + } return (int)(100 * num_letters + STRLEN(matched_string) + offset); } diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c index d16ad9db2c..afe2660cdf 100644 --- a/src/nvim/ex_docmd.c +++ b/src/nvim/ex_docmd.c @@ -2807,9 +2807,11 @@ int modifier_len(char_u *cmd) for (j = 0; p[j] != NUL; ++j) if (p[j] != cmdmods[i].name[j]) break; - if (!ASCII_ISALPHA(p[j]) && j >= cmdmods[i].minlen - && (p == cmd || cmdmods[i].has_count)) + if (j >= cmdmods[i].minlen + && !ASCII_ISALPHA(p[j]) + && (p == cmd || cmdmods[i].has_count)) { return j + (int)(p - cmd); + } } return 0; } diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c index 35159060b8..e5f5e5ad87 100644 --- a/src/nvim/ex_getln.c +++ b/src/nvim/ex_getln.c @@ -3575,7 +3575,7 @@ static int ccheck_abbr(int c) // Do not consider '<,'> be part of the mapping, skip leading whitespace. // Actually accepts any mark. - while (ascii_iswhite(ccline.cmdbuff[spos]) && spos < ccline.cmdlen) { + while (spos < ccline.cmdlen && ascii_iswhite(ccline.cmdbuff[spos])) { spos++; } if (ccline.cmdlen - spos > 5 diff --git a/src/nvim/hardcopy.c b/src/nvim/hardcopy.c index 4b361d2d45..cb5c5338a1 100644 --- a/src/nvim/hardcopy.c +++ b/src/nvim/hardcopy.c @@ -2305,13 +2305,10 @@ int mch_print_init(prt_settings_T *psettings, char_u *jobname, int forceit) || TOLOWER_ASC(printer_opts[OPT_PRINT_COLLATE].string[0]) == 'y'); if (prt_collate) { - /* TODO: Get number of collated copies wanted. */ - psettings->n_collated_copies = 1; + // TODO(vim): Get number of collated copies wanted. } else { - /* TODO: Get number of uncollated copies wanted and update the cached - * count. - */ - prt_num_copies = 1; + // TODO(vim): Get number of uncollated copies wanted and update the cached + // count. } psettings->jobname = jobname; diff --git a/src/nvim/lua/executor.c b/src/nvim/lua/executor.c index 1d3d9929d3..2cd6c0db66 100644 --- a/src/nvim/lua/executor.c +++ b/src/nvim/lua/executor.c @@ -770,8 +770,10 @@ static void typval_exec_lua(const char *lcmd, size_t lcmd_len, const char *name, typval_T *ret_tv) { if (check_restricted() || check_secure()) { - ret_tv->v_type = VAR_NUMBER; - ret_tv->vval.v_number = 0; + if (ret_tv) { + ret_tv->v_type = VAR_NUMBER; + ret_tv->vval.v_number = 0; + } return; } diff --git a/src/nvim/misc1.c b/src/nvim/misc1.c index a871d424c6..8c19a2de66 100644 --- a/src/nvim/misc1.c +++ b/src/nvim/misc1.c @@ -277,7 +277,7 @@ int get_last_leader_offset(char_u *line, char_u **flags) // whitespace. Otherwise we would think we are inside a // comment if the middle part appears somewhere in the middle // of the line. E.g. for C the "*" appears often. - for (j = 0; ascii_iswhite(line[j]) && j <= i; j++) { + for (j = 0; j <= i && ascii_iswhite(line[j]); j++) { } if (j < i) { continue; diff --git a/src/nvim/mouse.c b/src/nvim/mouse.c index deb7ee6342..de2db63651 100644 --- a/src/nvim/mouse.c +++ b/src/nvim/mouse.c @@ -479,7 +479,7 @@ win_T *mouse_find_win(int *gridp, int *rowp, int *colp) static win_T *mouse_find_grid_win(int *gridp, int *rowp, int *colp) { if (*gridp == msg_grid.handle) { - rowp += msg_grid_pos; + // rowp += msg_grid_pos; // PVS: dead store #11612 *gridp = DEFAULT_GRID_HANDLE; } else if (*gridp > 1) { win_T *wp = get_win_by_grid_handle(*gridp); diff --git a/src/nvim/ops.c b/src/nvim/ops.c index 0ca16e2c25..b597c5b214 100644 --- a/src/nvim/ops.c +++ b/src/nvim/ops.c @@ -1672,17 +1672,6 @@ setmarks: extmark_col_adjust_delete(curbuf, lnum, mincol, endcol, kExtmarkUndo, 0); } - - // Delete characters within one line, - // The case with multiple lines is handled by do_join - } else if (oap->motion_type == kMTCharWise && oap->line_count == 1) { - // + 1 to change to buf mode, then plus 1 to fit function requirements - endcol = oap->end.col + 1 + 1; - - lnum = curwin->w_cursor.lnum; - if (oap->is_VIsual == false) { - endcol = MAX(endcol - 1, mincol); - } } return OK; } diff --git a/src/nvim/os/env.c b/src/nvim/os/env.c index 360609c50d..ec266796a8 100644 --- a/src/nvim/os/env.c +++ b/src/nvim/os/env.c @@ -266,10 +266,8 @@ void os_copy_fullenv(char **env, size_t env_size) extern char **environ; # endif - size_t i = 0; - while (environ[i] != NULL && i < env_size) { + for (size_t i = 0; i < env_size && environ[i] != NULL; i++) { env[i] = xstrdup(environ[i]); - i++; } #endif } diff --git a/src/nvim/quickfix.c b/src/nvim/quickfix.c index 5d30ca624f..71c6f06ac0 100644 --- a/src/nvim/quickfix.c +++ b/src/nvim/quickfix.c @@ -1341,9 +1341,10 @@ static int qf_parse_fmt_t(regmatch_T *rmp, int midx, qffields_T *fields) /// Parse the match for '%+' format pattern. The whole matching line is included /// in the error string. Return the matched line in "fields->errmsg". -static int qf_parse_fmt_plus(char_u *linebuf, - size_t linelen, - qffields_T *fields) +static void qf_parse_fmt_plus(const char_u *linebuf, + size_t linelen, + qffields_T *fields) + FUNC_ATTR_NONNULL_ALL { if (linelen >= fields->errmsglen) { // linelen + null terminator @@ -1351,7 +1352,6 @@ static int qf_parse_fmt_plus(char_u *linebuf, fields->errmsglen = linelen + 1; } STRLCPY(fields->errmsg, linebuf, linelen + 1); - return QF_OK; } /// Parse the match for error message ('%m') pattern in regmatch. @@ -1508,7 +1508,7 @@ static int qf_parse_match(char_u *linebuf, size_t linelen, efm_T *fmt_ptr, status = qf_parse_fmt_f(regmatch, midx, fields, idx); } else if (i == 5) { if (fmt_ptr->flags == '+' && !qf_multiscan) { // %+ - status = qf_parse_fmt_plus(linebuf, linelen, fields); + qf_parse_fmt_plus(linebuf, linelen, fields); } else if (midx > 0) { // %m status = qf_parse_fmt_m(regmatch, midx, fields); } @@ -4513,7 +4513,7 @@ static void qf_get_nth_below_entry(qfline_T *entry, linenr_T n) { while (n-- > 0 && !got_int) { - qfline_T *first_entry = entry; + // qfline_T *first_entry = entry; int first_errornr = *errornr; // Treat all the entries on the same line in this file as one @@ -4523,7 +4523,7 @@ static void qf_get_nth_below_entry(qfline_T *entry, || entry->qf_next->qf_fnum != entry->qf_fnum) { // If multiple entries are on the same line, then use the first // entry - entry = first_entry; + // entry = first_entry; *errornr = first_errornr; break; } diff --git a/src/nvim/search.c b/src/nvim/search.c index 5e32715e49..3ee9777805 100644 --- a/src/nvim/search.c +++ b/src/nvim/search.c @@ -2175,17 +2175,14 @@ pos_T *findmatchlimit(oparg_T *oap, int initc, int flags, int64_t maxtravel) * Return MAXCOL if not, otherwise return the column. * TODO: skip strings. */ -static int check_linecomment(char_u *line) +static int check_linecomment(const char_u *line) { - char_u *p; - - p = line; - /* skip Lispish one-line comments */ + const char_u *p = line; // scan from start + // skip Lispish one-line comments if (curbuf->b_p_lisp) { if (vim_strchr(p, ';') != NULL) { /* there may be comments */ int in_str = FALSE; /* inside of string */ - p = line; /* scan from start */ while ((p = vim_strpbrk(p, (char_u *)"\";")) != NULL) { if (*p == '"') { if (in_str) { |