]> granicus.if.org Git - vim/commitdiff
patch 8.0.0666: dead for loop v8.0.0666
authorBram Moolenaar <Bram@vim.org>
Fri, 23 Jun 2017 21:00:08 +0000 (23:00 +0200)
committerBram Moolenaar <Bram@vim.org>
Fri, 23 Jun 2017 21:00:08 +0000 (23:00 +0200)
Problem:    Dead for loop. (Coverity)
Solution:   Remove the for loop.

src/term.c
src/version.c

index f36f093c9291178595519f0009b8f4bbba35094a..56d698bb256738801064bc71671a21b6190a6afe 100644 (file)
@@ -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;
+               /* 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;
 
-                   /* 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;
+               mouse_code = getdigits(&p);
+               if (*p++ != ';')
+                   return -1;
 
-                   if (key_name[0] == KS_SGR_MOUSE_RELEASE)
-                       mouse_code |= MOUSE_RELEASE;
+               /* 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;
 
-                   mouse_col = getdigits(&p) - 1;
-                   if (*p++ != ';')
-                       return -1;
+               if (key_name[0] == KS_SGR_MOUSE_RELEASE)
+                   mouse_code |= MOUSE_RELEASE;
 
-                   mouse_row = getdigits(&p) - 1;
+               mouse_col = getdigits(&p) - 1;
+               if (*p++ != ';')
+                   return -1;
 
-                   /* The modifiers were the mouse coordinates, not the
-                    * modifier keys (alt/shift/ctrl/meta) state. */
-                   modifiers = 0;
+               mouse_row = getdigits(&p) - 1;
 
-                   break;
-               }
+               /* The modifiers were the mouse coordinates, not the
+                * modifier keys (alt/shift/ctrl/meta) state. */
+               modifiers = 0;
            }
 # endif
 
index 8d8d4c8cf2a2d704a5336b131f783bf1911094f7..52ed102658e089f527e524e8703e4048ff01aaf0 100644 (file)
@@ -764,6 +764,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    666,
 /**/
     665,
 /**/