Mercurial > vim
changeset 11567:632daabce5d8 v8.0.0666
patch 8.0.0666: dead for loop
commit https://github.com/vim/vim/commit/5fe691240bff11e9618252486147f0156e875666
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Jun 23 23:00:08 2017 +0200
patch 8.0.0666: dead for loop
Problem: Dead for loop. (Coverity)
Solution: Remove the for loop.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Fri, 23 Jun 2017 23:00:04 +0200 |
parents | f3ac978df263 |
children | 153311004f95 |
files | src/term.c src/version.c |
diffstat | 2 files changed, 50 insertions(+), 53 deletions(-) [+] |
line wrap: on
line diff
--- a/src/term.c +++ b/src/term.c @@ -4601,59 +4601,54 @@ check_termcode( || key_name[0] == KS_SGR_MOUSE || key_name[0] == KS_SGR_MOUSE_RELEASE) { - for (;;) - { - /* URXVT 1015 mouse reporting mode: - * Almost identical to xterm mouse mode, except the values - * are decimal instead of bytes. - * - * \033[%d;%d;%dM - * ^-- row - * ^----- column - * ^-------- code - * - * SGR 1006 mouse reporting mode: - * Almost identical to xterm mouse mode, except the values - * are decimal instead of bytes. - * - * \033[<%d;%d;%dM - * ^-- row - * ^----- column - * ^-------- code - * - * \033[<%d;%d;%dm : mouse release event - * ^-- row - * ^----- column - * ^-------- code - */ - p = modifiers_start; - if (p == NULL) - return -1; - - mouse_code = getdigits(&p); - if (*p++ != ';') - return -1; - - /* when mouse reporting is SGR, add 32 to mouse code */ - if (key_name[0] == KS_SGR_MOUSE - || key_name[0] == KS_SGR_MOUSE_RELEASE) - mouse_code += 32; - - if (key_name[0] == KS_SGR_MOUSE_RELEASE) - mouse_code |= MOUSE_RELEASE; - - mouse_col = getdigits(&p) - 1; - if (*p++ != ';') - return -1; - - mouse_row = getdigits(&p) - 1; - - /* The modifiers were the mouse coordinates, not the - * modifier keys (alt/shift/ctrl/meta) state. */ - modifiers = 0; - - break; - } + /* URXVT 1015 mouse reporting mode: + * Almost identical to xterm mouse mode, except the values + * are decimal instead of bytes. + * + * \033[%d;%d;%dM + * ^-- row + * ^----- column + * ^-------- code + * + * SGR 1006 mouse reporting mode: + * Almost identical to xterm mouse mode, except the values + * are decimal instead of bytes. + * + * \033[<%d;%d;%dM + * ^-- row + * ^----- column + * ^-------- code + * + * \033[<%d;%d;%dm : mouse release event + * ^-- row + * ^----- column + * ^-------- code + */ + p = modifiers_start; + if (p == NULL) + return -1; + + mouse_code = getdigits(&p); + if (*p++ != ';') + return -1; + + /* when mouse reporting is SGR, add 32 to mouse code */ + if (key_name[0] == KS_SGR_MOUSE + || key_name[0] == KS_SGR_MOUSE_RELEASE) + mouse_code += 32; + + if (key_name[0] == KS_SGR_MOUSE_RELEASE) + mouse_code |= MOUSE_RELEASE; + + mouse_col = getdigits(&p) - 1; + if (*p++ != ';') + return -1; + + mouse_row = getdigits(&p) - 1; + + /* The modifiers were the mouse coordinates, not the + * modifier keys (alt/shift/ctrl/meta) state. */ + modifiers = 0; } # endif