[Pcre-svn] [515] code/trunk: Minor code refactor to avoid co…

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


Modified Paths:
--------------
    code/trunk/ChangeLog
    code/trunk/src/pcre2_compile.c


Modified: code/trunk/ChangeLog
===================================================================
--- code/trunk/ChangeLog    2016-05-19 18:09:07 UTC (rev 514)
+++ code/trunk/ChangeLog    2016-05-20 10:47:42 UTC (rev 515)
@@ -108,7 +108,11 @@


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

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

+
+
Version 10.21 12-January-2016
-----------------------------


Modified: code/trunk/src/pcre2_compile.c
===================================================================
--- code/trunk/src/pcre2_compile.c    2016-05-19 18:09:07 UTC (rev 514)
+++ code/trunk/src/pcre2_compile.c    2016-05-20 10:47:42 UTC (rev 515)
@@ -3962,6 +3962,10 @@
   uint32_t subreqcu, subfirstcu;
   int32_t subreqcuflags, subfirstcuflags;  /* Must be signed */
   PCRE2_UCHAR mcbuffer[8];
+  
+  /* Come here to restart the loop. */
+  
+  REDO_LOOP: 


/* Get next character in the pattern */

@@ -4103,11 +4107,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. */
@@ -4247,17 +4247,15 @@
     if (PRIV(strncmp_c8)(ptr+1, STRING_WEIRD_STARTWORD, 6) == 0)
       {
       cb->nestptr[0] = ptr + 7;
-      ptr = sub_start_of_word;  /* Do not combine these statements; clang's */
-      ptr--;                    /* sanitizer moans about a negative index. */
-      continue;
+      ptr = sub_start_of_word;
+      goto REDO_LOOP; 
       }


     if (PRIV(strncmp_c8)(ptr+1, STRING_WEIRD_ENDWORD, 6) == 0)
       {
       cb->nestptr[0] = ptr + 7;
-      ptr = sub_end_of_word;    /* Do not combine these statements; clang's */
-      ptr--;                    /* sanitizer moans about a negative index. */
-      continue;
+      ptr = sub_end_of_word;
+      goto REDO_LOOP; 
       }


     /* Handle a real character class. */