diff options
author | ZyX <kp-pav@yandex.ru> | 2018-04-15 21:49:47 +0300 |
---|---|---|
committer | ZyX <kp-pav@yandex.ru> | 2018-04-15 21:49:47 +0300 |
commit | fc1ebb060e8364a947bc93ab578179a23aa9b81d (patch) | |
tree | 7496a3a2b166e267fc56c19e2f7614b09bf60fe0 | |
parent | dae1975394ba6b4b385115c3f4fa90b3ac7401d0 (diff) | |
download | rneovim-fc1ebb060e8364a947bc93ab578179a23aa9b81d.tar.gz rneovim-fc1ebb060e8364a947bc93ab578179a23aa9b81d.tar.bz2 rneovim-fc1ebb060e8364a947bc93ab578179a23aa9b81d.zip |
ops: Fix PVS/V614: use of uninitialized variable
I have actually no idea how code managed to work and not trigger ASAN/etc here.
It does not look like a false positive at all.
-rw-r--r-- | src/nvim/ops.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/nvim/ops.c b/src/nvim/ops.c index 2828a11d6e..8e272e475c 100644 --- a/src/nvim/ops.c +++ b/src/nvim/ops.c @@ -3568,7 +3568,7 @@ int do_join(size_t count, int *comments = NULL; int remove_comments = (use_formatoptions == TRUE) && has_format_option(FO_REMOVE_COMS); - bool prev_was_comment; + bool prev_was_comment = false; if (save_undo && u_save(curwin->w_cursor.lnum - 1, curwin->w_cursor.lnum + (linenr_T)count) == FAIL) { @@ -3592,17 +3592,17 @@ int do_join(size_t count, curwin->w_buffer->b_op_start.col = (colnr_T)STRLEN(curr); } if (remove_comments) { - /* We don't want to remove the comment leader if the - * previous line is not a comment. */ + // We don't want to remove the comment leader if the + // previous line is not a comment. if (t > 0 && prev_was_comment) { - char_u *new_curr = skip_comment(curr, TRUE, insert_space, - &prev_was_comment); + char_u *new_curr = skip_comment(curr, true, insert_space, + &prev_was_comment); comments[t] = (int)(new_curr - curr); curr = new_curr; - } else - curr = skip_comment(curr, FALSE, insert_space, - &prev_was_comment); + } else { + curr = skip_comment(curr, false, insert_space, &prev_was_comment); + } } if (insert_space && t > 0) { |