mirror of
https://github.com/neovim/neovim.git
synced 2026-07-16 22:21:30 +00:00
Merge #11612 from janlazo/clang-pvs
This commit is contained in:
@@ -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")) {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user