[vim/vim] Coverity reports dead code (PR #14189)

10 views
Skip to first unread message

zeertzjq

unread,
Mar 12, 2024, 10:00:00 PM3/12/24
to vim/vim, Subscribed

Problem: Coverity reports dead code.
Solution: Remove the dead code. Also fix some comments in other files.


You can view, comment on, or merge this pull request online at:

  https://github.com/vim/vim/pull/14189

Commit Summary

  • 2bfd5dc Coverity reports dead code

File Changes

(5 files)

Patch Links:


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/14189@github.com>

zeertzjq

unread,
Mar 13, 2024, 3:13:03 AM3/13/24
to vim/vim, Push

@zeertzjq pushed 1 commit.

  • 0e5d048 Coverity reports dead code


View it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/14189/push/17518113105@github.com>

zeertzjq

unread,
Mar 13, 2024, 4:30:36 AM3/13/24
to vim/vim, Push

@zeertzjq pushed 1 commit.

  • e565151 Coverity reports dead code


View it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/14189/push/17519135908@github.com>

Christian Brabandt

unread,
Mar 13, 2024, 5:03:43 AM3/13/24
to vim/vim, Subscribed

@chrisbra commented on this pull request.


In src/ops.c:

>      col = pos->col;
 
-    if (*ptr == NUL || col + !!save_coladd >= (int)STRLEN(ptr))

why is the *ptr == NUL condition removed?


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/14189/review/1933507204@github.com>

zeertzjq

unread,
Mar 13, 2024, 5:11:33 AM3/13/24
to vim/vim, Subscribed

@zeertzjq commented on this pull request.


In src/ops.c:

>      col = pos->col;
 
-    if (*ptr == NUL || col + !!save_coladd >= (int)STRLEN(ptr))

It's not needed because col >= 0, and ml_get_len() returns 0 if *ptr == NUL.


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/14189/review/1933523846@github.com>

Christian Brabandt

unread,
Mar 13, 2024, 6:21:25 AM3/13/24
to vim/vim, Subscribed

@chrisbra commented on this pull request.


In src/memline.c:

> @@ -2686,7 +2686,7 @@ ml_get_len(linenr_T lnum)
     colnr_T
 ml_get_pos_len(pos_T *pos)
 {
-    return ml_get_buf_len(curbuf, curwin->w_cursor.lnum) - pos->col;
+    return ml_get_buf_len(curbuf, pos->lnum) - pos->col;

oh, I should have caught this when reviewing yesterday :/


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/14189/review/1933712836@github.com>

Christian Brabandt

unread,
Mar 13, 2024, 3:42:28 PM3/13/24
to vim/vim, Subscribed

@chrisbra commented on this pull request.


In src/ops.c:

>      col = pos->col;
 
-    if (*ptr == NUL || col + !!save_coladd >= (int)STRLEN(ptr))

ah, so when *ptr == NUL this means that the second condition will be also true: col + !!save_coladd >= linelen I see. thanks


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/14189/review/1933732366@github.com>

Christian Brabandt

unread,
Mar 13, 2024, 3:46:14 PM3/13/24
to vim/vim, Subscribed

thanks!


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/14189/c1995549273@github.com>

Christian Brabandt

unread,
Mar 13, 2024, 3:46:23 PM3/13/24
to vim/vim, Subscribed

Closed #14189 via 8c55d60.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/14189/issue_event/12108407411@github.com>

Reply all
Reply to author
Forward
0 new messages