[Pcre-svn] [822] code/branches/pcre16: fix 16 bit issues rep…

Top Page
Delete this message
Author: Subversion repository
Date:  
To: pcre-svn
Subject: [Pcre-svn] [822] code/branches/pcre16: fix 16 bit issues reported by valgrind
Revision: 822
          http://vcs.pcre.org/viewvc?view=rev&revision=822
Author:   zherczeg
Date:     2011-12-23 20:37:29 +0000 (Fri, 23 Dec 2011)


Log Message:
-----------
fix 16 bit issues reported by valgrind

Modified Paths:
--------------
    code/branches/pcre16/pcre_compile.c
    code/branches/pcre16/pcre_jit_compile.c
    code/branches/pcre16/pcretest.c


Modified: code/branches/pcre16/pcre_compile.c
===================================================================
--- code/branches/pcre16/pcre_compile.c    2011-12-23 16:38:13 UTC (rev 821)
+++ code/branches/pcre16/pcre_compile.c    2011-12-23 20:37:29 UTC (rev 822)
@@ -7749,6 +7749,7 @@
 cd->start_pattern = (const pcre_uchar *)pattern;
 cd->end_pattern = (const pcre_uchar *)(pattern + STRLEN_UC((const pcre_uchar *)pattern));
 cd->req_varyopt = 0;
+cd->assert_depth = 0;
 cd->external_options = options;
 cd->external_flags = 0;
 cd->open_caps = NULL;


Modified: code/branches/pcre16/pcre_jit_compile.c
===================================================================
--- code/branches/pcre16/pcre_jit_compile.c    2011-12-23 16:38:13 UTC (rev 821)
+++ code/branches/pcre16/pcre_jit_compile.c    2011-12-23 20:37:29 UTC (rev 822)
@@ -1497,7 +1497,7 @@


 static void skip_char_back(compiler_common *common)
 {
-/* Goes one character back. Only affects STR_PTR. Does not check begin. */
+/* Goes one character back. Affects STR_PTR and TMP1. Does not check begin. */
 DEFINE_COMPILER;
 #if defined SUPPORT_UTF && defined COMPILE_PCRE8
 struct sljit_label *label;
@@ -3403,19 +3403,20 @@
   length = GET(cc, 0);
   SLJIT_ASSERT(length > 0);
   OP1(SLJIT_MOV, TMP1, 0, ARGUMENTS, 0);
-  OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, begin));
 #ifdef SUPPORT_UTF
   if (common->utf)
     {
+    OP1(SLJIT_MOV, TMP3, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, begin));
     OP1(SLJIT_MOV, TMP2, 0, SLJIT_IMM, length);
     label = LABEL();
-    add_jump(compiler, fallbacks, CMP(SLJIT_C_LESS_EQUAL, STR_PTR, 0, TMP1, 0));
+    add_jump(compiler, fallbacks, CMP(SLJIT_C_LESS_EQUAL, STR_PTR, 0, TMP3, 0));
     skip_char_back(common);
     OP2(SLJIT_SUB | SLJIT_SET_E, TMP2, 0, TMP2, 0, SLJIT_IMM, 1);
     JUMPTO(SLJIT_C_NOT_ZERO, label);
     return cc + LINK_SIZE;
     }
 #endif
+  OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, begin));
   OP2(SLJIT_SUB, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(length));
   add_jump(compiler, fallbacks, CMP(SLJIT_C_LESS, STR_PTR, 0, TMP1, 0));
   return cc + LINK_SIZE;


Modified: code/branches/pcre16/pcretest.c
===================================================================
--- code/branches/pcre16/pcretest.c    2011-12-23 16:38:13 UTC (rev 821)
+++ code/branches/pcre16/pcretest.c    2011-12-23 20:37:29 UTC (rev 822)
@@ -2855,7 +2855,7 @@
       int count, backrefmax, first_char, need_char, okpartial, jchanged,
         hascrorlf;
       int nameentrysize, namecount;
-      const pcre_uchar *nametable;
+      const pcre_uint8 *nametable;


       new_info(re, NULL, PCRE_INFO_SIZE, &size);
       new_info(re, NULL, PCRE_INFO_CAPTURECOUNT, &count);
@@ -2898,8 +2898,12 @@
           nametable += nameentrysize * (use_pcre16 ? 2 : 1);
 #else
           fprintf(outfile, "%3d\n", GET2(nametable, 0));
+#ifdef SUPPORT_PCRE8
           nametable += nameentrysize;
+#else
+          nametable += nameentrysize * 2;
 #endif
+#endif
           }
         }