[Pcre-svn] [1648] code/trunk: Minor refactor to avoid compil…

Top Page
Delete this message
Author: Subversion repository
Date:  
To: pcre-svn
Subject: [Pcre-svn] [1648] code/trunk: Minor refactor to avoid compiler warning.
Revision: 1648
          http://vcs.pcre.org/viewvc?view=rev&revision=1648
Author:   ph10
Date:     2016-05-20 11:33:36 +0100 (Fri, 20 May 2016)
Log Message:
-----------
Minor refactor to avoid compiler warning.


Modified Paths:
--------------
    code/trunk/ChangeLog
    code/trunk/pcre_compile.c


Modified: code/trunk/ChangeLog
===================================================================
--- code/trunk/ChangeLog    2016-05-19 18:02:51 UTC (rev 1647)
+++ code/trunk/ChangeLog    2016-05-20 10:33:36 UTC (rev 1648)
@@ -81,7 +81,10 @@


20. A racing condition is fixed in JIT reported by Mozilla.

+21. Minor code refactor to avoid "array subscript is below array bounds"
+compiler warning.

+
Version 8.38 23-November-2015
-----------------------------


Modified: code/trunk/pcre_compile.c
===================================================================
--- code/trunk/pcre_compile.c    2016-05-19 18:02:51 UTC (rev 1647)
+++ code/trunk/pcre_compile.c    2016-05-20 10:33:36 UTC (rev 1648)
@@ -4566,6 +4566,10 @@
   unsigned int tempbracount;
   pcre_uint32 ec;
   pcre_uchar mcbuffer[8];
+  
+  /* Come here to restart the loop without advancing the pointer. */
+  
+  REDO_LOOP: 


/* Get next character in the pattern */

@@ -4712,11 +4716,7 @@
     /* If we skipped any characters, restart the loop. Otherwise, we didn't see
     a comment. */


-    if (ptr > wscptr)
-      {
-      ptr--;
-      continue;
-      }
+    if (ptr > wscptr) goto REDO_LOOP;
     }


   /* Skip over (?# comments. We need to do this here because we want to know if
@@ -4857,15 +4857,15 @@
     if (STRNCMP_UC_C8(ptr+1, STRING_WEIRD_STARTWORD, 6) == 0)
       {
       nestptr = ptr + 7;
-      ptr = sub_start_of_word - 1;
-      continue;
+      ptr = sub_start_of_word;
+      goto REDO_LOOP;
       }


     if (STRNCMP_UC_C8(ptr+1, STRING_WEIRD_ENDWORD, 6) == 0)
       {
       nestptr = ptr + 7;
-      ptr = sub_end_of_word - 1;
-      continue;
+      ptr = sub_end_of_word;
+      goto REDO_LOOP;
       }


     /* Handle a real character class. */