pvs/v1048: variable was assigned same value

This commit is contained in:
Jan Edmund Lazo 2020-02-22 12:09:21 -05:00
parent 0eb2f2be60
commit 607240a8ba
No known key found for this signature in database
GPG Key ID: 64915E6E9F735B15
4 changed files with 23 additions and 28 deletions

View File

@ -5297,7 +5297,6 @@ static void f_list2str(typval_T *argvars, typval_T *rettv, FunPtr fptr)
});
ga_append(&ga, NUL);
rettv->v_type = VAR_STRING;
rettv->vval.v_string = ga.ga_data;
}

View File

@ -3372,11 +3372,9 @@ term_again:
continue;
}
/*
* Are we at the start of a cpp base class declaration or
* constructor initialization?
*/ /* XXX */
n = false;
// Are we at the start of a cpp base class declaration or
// constructor initialization? XXX
n = 0;
if (curbuf->b_ind_cpp_baseclass != 0 && theline[0] != '{') {
n = cin_is_cpp_baseclass(&cache_cpp_baseclass);
l = get_cursor_line_ptr();
@ -3409,7 +3407,6 @@ term_again:
* } foo,
* bar;
*/
n = 0;
if (cin_ends_in(l, (char_u *)",", NULL)
|| (*l != NUL && (n = l[STRLEN(l) - 1]) == '\\')) {
/* take us back to opening paren */

View File

@ -2534,7 +2534,7 @@ static void op_yank_reg(oparg_T *oap, bool message, yankreg_T *reg, bool append)
case kMTCharWise:
{
colnr_T startcol = 0, endcol = MAXCOL;
int is_oneChar = FALSE;
int is_oneChar = false;
colnr_T cs, ce;
p = ml_get(lnum);
bd.startspaces = 0;
@ -2565,8 +2565,8 @@ static void op_yank_reg(oparg_T *oap, bool message, yankreg_T *reg, bool append)
&& utf_head_off(p, p + endcol) == 0)) {
if (oap->start.lnum == oap->end.lnum
&& oap->start.col == oap->end.col) {
/* Special case: inside a single char */
is_oneChar = TRUE;
// Special case: inside a single char
is_oneChar = true;
bd.startspaces = oap->end.coladd
- oap->start.coladd + oap->inclusive;
endcol = startcol;
@ -4425,8 +4425,8 @@ static void block_prep(oparg_T *oap, struct block_def *bdp, linenr_T lnum,
bdp->textlen = 0;
bdp->start_vcol = 0;
bdp->end_vcol = 0;
bdp->is_short = FALSE;
bdp->is_oneChar = FALSE;
bdp->is_short = false;
bdp->is_oneChar = false;
bdp->pre_whitesp = 0;
bdp->pre_whitesp_c = 0;
bdp->end_char_vcols = 0;
@ -4452,9 +4452,10 @@ static void block_prep(oparg_T *oap, struct block_def *bdp, linenr_T lnum,
bdp->start_char_vcols = incr;
if (bdp->start_vcol < oap->start_vcol) { /* line too short */
bdp->end_vcol = bdp->start_vcol;
bdp->is_short = TRUE;
if (!is_del || oap->op_type == OP_APPEND)
bdp->is_short = true;
if (!is_del || oap->op_type == OP_APPEND) {
bdp->endspaces = oap->end_vcol - oap->start_vcol + 1;
}
} else {
/* notice: this converts partly selected Multibyte characters to
* spaces, too. */
@ -4463,11 +4464,11 @@ static void block_prep(oparg_T *oap, struct block_def *bdp, linenr_T lnum,
bdp->startspaces = bdp->start_char_vcols - bdp->startspaces;
pend = pstart;
bdp->end_vcol = bdp->start_vcol;
if (bdp->end_vcol > oap->end_vcol) { /* it's all in one character */
bdp->is_oneChar = TRUE;
if (oap->op_type == OP_INSERT)
if (bdp->end_vcol > oap->end_vcol) { // it's all in one character
bdp->is_oneChar = true;
if (oap->op_type == OP_INSERT) {
bdp->endspaces = bdp->start_char_vcols - bdp->startspaces;
else if (oap->op_type == OP_APPEND) {
} else if (oap->op_type == OP_APPEND) {
bdp->startspaces += oap->end_vcol - oap->start_vcol + 1;
bdp->endspaces = bdp->start_char_vcols - bdp->startspaces;
} else {
@ -4492,17 +4493,16 @@ static void block_prep(oparg_T *oap, struct block_def *bdp, linenr_T lnum,
if (bdp->end_vcol <= oap->end_vcol
&& (!is_del
|| oap->op_type == OP_APPEND
|| oap->op_type == OP_REPLACE)) { /* line too short */
bdp->is_short = TRUE;
/* Alternative: include spaces to fill up the block.
* Disadvantage: can lead to trailing spaces when the line is
* short where the text is put */
/* if (!is_del || oap->op_type == OP_APPEND) */
if (oap->op_type == OP_APPEND || virtual_op)
|| oap->op_type == OP_REPLACE)) { // line too short
bdp->is_short = true;
// Alternative: include spaces to fill up the block.
// Disadvantage: can lead to trailing spaces when the line is
// short where the text is put
// if (!is_del || oap->op_type == OP_APPEND)
if (oap->op_type == OP_APPEND || virtual_op) {
bdp->endspaces = oap->end_vcol - bdp->end_vcol
+ oap->inclusive;
else
bdp->endspaces = 0; /* replace doesn't add characters */
}
} else if (bdp->end_vcol > oap->end_vcol) {
bdp->endspaces = bdp->end_vcol - oap->end_vcol - 1;
if (!is_del && bdp->endspaces) {

View File

@ -448,7 +448,6 @@ int os_expand_wildcards(int num_pat, char_u **pat, int *num_file,
} else {
buffer[len] = NUL;
}
i = 0;
for (p = buffer; p < buffer + len; p++) {
if (*p == NUL || (*p == ' ' && check_spaces)) { // count entry
i++;