2007-11-24 Eric Seidel <eric@webkit.org>
authoreric@webkit.org <eric@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 29 Nov 2007 11:14:21 +0000 (11:14 +0000)
committereric@webkit.org <eric@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 29 Nov 2007 11:14:21 +0000 (11:14 +0000)
        Reviewed by Sam.

        Pass around MatchData objects by reference

        * pcre/pcre_exec.cpp:
        (pchars):
        (match_ref):
        (match):
        (jsRegExpExecute):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@28149 268f45cc-cd09-0410-ab3c-d52691b4dbfc

JavaScriptCore/ChangeLog
JavaScriptCore/pcre/pcre_exec.cpp

index ed8e00c91d3d661800add85c70808f788f37eb60..fd1a9d0f6e5e1f72edce06290e3d709cb401b3fe 100644 (file)
@@ -1,3 +1,15 @@
+2007-11-24  Eric Seidel  <eric@webkit.org>
+
+        Reviewed by Sam.
+
+        Pass around MatchData objects by reference
+
+        * pcre/pcre_exec.cpp:
+        (pchars):
+        (match_ref):
+        (match):
+        (jsRegExpExecute):
+
 2007-11-24  Eric Seidel  <eric@webkit.org>
 
         Reviewed by Sam.
index bf217d280d7dd5f193cfe4939865f8b326333288..bb85ee7de3034ee6ff8af75359633a2e47821227 100644 (file)
@@ -159,16 +159,16 @@ subject if the requested.
 Arguments:
   p           points to characters
   length      number to print
-  is_subject  true if printing from within md->start_subject
+  is_subject  true if printing from within md.start_subject
   md          pointer to matching data block, if is_subject is true
 
 Returns:     nothing
 */
 
-static void pchars(const UChar* p, int length, bool is_subject, MatchData *md)
+static void pchars(const UChar* p, int length, bool is_subject, const MatchData& md)
 {
-    if (is_subject && length > md->end_subject - p)
-        length = md->end_subject - p;
+    if (is_subject && length > md.end_subject - p)
+        length = md.end_subject - p;
     while (length-- > 0) {
         int c;
         if (isprint(c = *(p++)))
@@ -199,48 +199,48 @@ Arguments:
 Returns:      true if matched
 */
 
-static bool
-match_ref(int offset, UChar* eptr, int length, MatchData *md)
+static bool match_ref(int offset, UChar* eptr, int length, const MatchData& md)
 {
-UChar* p = md->start_subject + md->offset_vector[offset];
-
+    UChar* p = md.start_subject + md.offset_vector[offset];
+    
 #ifdef DEBUG
-if (eptr >= md->end_subject)
-  printf("matching subject <null>");
-else
-  {
-  printf("matching subject ");
-  pchars(eptr, length, true, md);
-  }
-printf(" against backref ");
-pchars(p, length, false, md);
-printf("\n");
+    if (eptr >= md.end_subject)
+        printf("matching subject <null>");
+    else {
+        printf("matching subject ");
+        pchars(eptr, length, true, md);
+    }
+    printf(" against backref ");
+    pchars(p, length, false, md);
+    printf("\n");
 #endif
-
-/* Always fail if not enough characters left */
-
-if (length > md->end_subject - eptr) return false;
-
-/* Separate the caselesss case for speed */
-
-if (md->caseless)
-  {
-  while (length-- > 0)
-    {
-    UChar c = *p++;
-    int othercase = _pcre_ucp_othercase(c);
-    UChar d = *eptr++;
-    if (c != d && othercase != d) return false;
+    
+    /* Always fail if not enough characters left */
+    
+    if (length > md.end_subject - eptr)
+        return false;
+    
+    /* Separate the caselesss case for speed */
+    
+    if (md.caseless) {
+        while (length-- > 0) {
+            UChar c = *p++;
+            int othercase = _pcre_ucp_othercase(c);
+            UChar d = *eptr++;
+            if (c != d && othercase != d)
+                return false;
+        }
     }
-  }
-else
-  { while (length-- > 0) if (*p++ != *eptr++) return false; }
-
-return true;
+    else {
+        while (length-- > 0)
+            if (*p++ != *eptr++)
+                return false;
+    }
+    
+    return true;
 }
 
 
-
 /***************************************************************************
 ****************************************************************************
                    RECURSION IN THE match() FUNCTION
@@ -407,7 +407,7 @@ static inline void getUTF8CharAndIncrementLength(int& c, const uschar* eptr, int
     }
 }
 
-static int match(UChar* eptr, const uschar* ecode, int offset_top, MatchData* md)
+static int match(UChar* eptr, const uschar* ecode, int offset_top, MatchData& md)
 {
     int is_match = false;
     int i;
@@ -463,7 +463,7 @@ RECURSE:
     /* First check that we haven't called match() too many times, or that we
      haven't exceeded the recursive call limit. */
     
-    if (md->match_call_count++ >= MATCH_LIMIT)
+    if (md.match_call_count++ >= MATCH_LIMIT)
         return matchError(JSRegExpErrorMatchLimit, stack);
     if (rdepth >= MATCH_LIMIT_RECURSION)
         return matchError(JSRegExpErrorRecursionLimit, stack);
@@ -523,8 +523,8 @@ RECURSE:
                 /* End of the pattern. */
                 
                 BEGIN_OPCODE(END):
-                md->end_match_ptr = stack.currentFrame->eptr;          /* Record where we ended */
-                md->end_offset_top = stack.currentFrame->offset_top;   /* and how many extracts were taken */
+                md.end_match_ptr = stack.currentFrame->eptr;          /* Record where we ended */
+                md.end_offset_top = stack.currentFrame->offset_top;   /* and how many extracts were taken */
                 is_match = true;
                 RRETURN;
                 
@@ -549,7 +549,7 @@ RECURSE:
                 
                 do stack.currentFrame->ecode += GET(stack.currentFrame->ecode,1); while (*stack.currentFrame->ecode == OP_ALT);
                 stack.currentFrame->ecode += 1 + LINK_SIZE;
-                stack.currentFrame->offset_top = md->end_offset_top;
+                stack.currentFrame->offset_top = md.end_offset_top;
                 NEXT_OPCODE;
                 
                 /* Negative assertion: all branches must fail to match */
@@ -593,8 +593,8 @@ RECURSE:
                 
                 do stack.currentFrame->ecode += GET(stack.currentFrame->ecode,1); while (*stack.currentFrame->ecode == OP_ALT);
                 
-                stack.currentFrame->offset_top = md->end_offset_top;
-                stack.currentFrame->eptr = md->end_match_ptr;
+                stack.currentFrame->offset_top = md.end_offset_top;
+                stack.currentFrame->eptr = md.end_match_ptr;
                 
                 /* For a non-repeating ket, just continue at this level. This also
                  happens for a repeating ket if no characters were matched in the group.
@@ -680,8 +680,8 @@ RECURSE:
                 stack.currentFrame->eptrb = stack.currentFrame->eptrb->epb_prev;
                 
                 if (*stack.currentFrame->prev == OP_ASSERT || *stack.currentFrame->prev == OP_ASSERT_NOT || *stack.currentFrame->prev == OP_ONCE) {
-                    md->end_match_ptr = stack.currentFrame->eptr;      /* For ONCE */
-                    md->end_offset_top = stack.currentFrame->offset_top;
+                    md.end_match_ptr = stack.currentFrame->eptr;      /* For ONCE */
+                    md.end_offset_top = stack.currentFrame->offset_top;
                     is_match = true;
                     RRETURN;
                 }
@@ -710,12 +710,12 @@ RECURSE:
                  the OP_END is reached. */
                 
                 if (stack.currentFrame->number > 0) {
-                    if (stack.currentFrame->offset >= md->offset_max)
-                        md->offset_overflow = true;
+                    if (stack.currentFrame->offset >= md.offset_max)
+                        md.offset_overflow = true;
                     else {
-                        md->offset_vector[stack.currentFrame->offset] =
-                        md->offset_vector[md->offset_end - stack.currentFrame->number];
-                        md->offset_vector[stack.currentFrame->offset+1] = stack.currentFrame->eptr - md->start_subject;
+                        md.offset_vector[stack.currentFrame->offset] =
+                        md.offset_vector[md.offset_end - stack.currentFrame->number];
+                        md.offset_vector[stack.currentFrame->offset+1] = stack.currentFrame->eptr - md.start_subject;
                         if (stack.currentFrame->offset_top <= stack.currentFrame->offset)
                             stack.currentFrame->offset_top = stack.currentFrame->offset + 2;
                     }
@@ -755,7 +755,7 @@ RECURSE:
                 /* Start of subject, or after internal newline if multiline. */
                 
                 BEGIN_OPCODE(CIRC):
-                if (stack.currentFrame->eptr != md->start_subject && (!md->multiline || !isNewline(stack.currentFrame->eptr[-1])))
+                if (stack.currentFrame->eptr != md.start_subject && (!md.multiline || !isNewline(stack.currentFrame->eptr[-1])))
                     RRETURN_NO_MATCH;
                 stack.currentFrame->ecode++;
                 NEXT_OPCODE;
@@ -763,7 +763,7 @@ RECURSE:
                 /* End of subject, or before internal newline if multiline. */
                 
                 BEGIN_OPCODE(DOLL):
-                if (stack.currentFrame->eptr < md->end_subject && (!md->multiline || !isNewline(*stack.currentFrame->eptr)))
+                if (stack.currentFrame->eptr < md.end_subject && (!md.multiline || !isNewline(*stack.currentFrame->eptr)))
                     RRETURN_NO_MATCH;
                 stack.currentFrame->ecode++;
                 NEXT_OPCODE;
@@ -776,20 +776,20 @@ RECURSE:
                  It takes a bit more work in UTF-8 mode. Characters > 128 are assumed to
                  be "non-word" characters. */
                 
-                if (stack.currentFrame->eptr == md->start_subject)
+                if (stack.currentFrame->eptr == md.start_subject)
                     prev_is_word = false;
                 else {
                     const UChar* lastptr = stack.currentFrame->eptr - 1;
                     while(isTrailingSurrogate(*lastptr))
                         lastptr--;
                     getChar(c, lastptr);
-                    prev_is_word = c < 128 && (md->ctypes[c] & ctype_word) != 0;
+                    prev_is_word = c < 128 && (md.ctypes[c] & ctype_word) != 0;
                 }
-                if (stack.currentFrame->eptr >= md->end_subject)
+                if (stack.currentFrame->eptr >= md.end_subject)
                     cur_is_word = false;
                 else {
                     getChar(c, stack.currentFrame->eptr);
-                    cur_is_word = c < 128 && (md->ctypes[c] & ctype_word) != 0;
+                    cur_is_word = c < 128 && (md.ctypes[c] & ctype_word) != 0;
                 }
                 
                 /* Now see if the situation is what we want */
@@ -801,17 +801,17 @@ RECURSE:
                 /* Match a single character type; inline for speed */
                 
                 BEGIN_OPCODE(ANY):
-                if (stack.currentFrame->eptr < md->end_subject && isNewline(*stack.currentFrame->eptr))
+                if (stack.currentFrame->eptr < md.end_subject && isNewline(*stack.currentFrame->eptr))
                     RRETURN_NO_MATCH;
-                if (stack.currentFrame->eptr++ >= md->end_subject)
+                if (stack.currentFrame->eptr++ >= md.end_subject)
                     RRETURN_NO_MATCH;
-                while (stack.currentFrame->eptr < md->end_subject && isTrailingSurrogate(*stack.currentFrame->eptr))
+                while (stack.currentFrame->eptr < md.end_subject && isTrailingSurrogate(*stack.currentFrame->eptr))
                     stack.currentFrame->eptr++;
                 stack.currentFrame->ecode++;
                 NEXT_OPCODE;
                 
                 BEGIN_OPCODE(NOT_DIGIT):
-                if (stack.currentFrame->eptr >= md->end_subject)
+                if (stack.currentFrame->eptr >= md.end_subject)
                     RRETURN_NO_MATCH;
                 GETCHARINCTEST(c, stack.currentFrame->eptr);
                 if (isASCIIDigit(c))
@@ -820,7 +820,7 @@ RECURSE:
                 NEXT_OPCODE;
                 
                 BEGIN_OPCODE(DIGIT):
-                if (stack.currentFrame->eptr >= md->end_subject)
+                if (stack.currentFrame->eptr >= md.end_subject)
                     RRETURN_NO_MATCH;
                 GETCHARINCTEST(c, stack.currentFrame->eptr);
                 if (!isASCIIDigit(c))
@@ -829,37 +829,37 @@ RECURSE:
                 NEXT_OPCODE;
                 
                 BEGIN_OPCODE(NOT_WHITESPACE):
-                if (stack.currentFrame->eptr >= md->end_subject)
+                if (stack.currentFrame->eptr >= md.end_subject)
                     RRETURN_NO_MATCH;
                 GETCHARINCTEST(c, stack.currentFrame->eptr);
-                if (c < 128 && (md->ctypes[c] & ctype_space))
+                if (c < 128 && (md.ctypes[c] & ctype_space))
                     RRETURN_NO_MATCH;
                 stack.currentFrame->ecode++;
                 NEXT_OPCODE;
                 
                 BEGIN_OPCODE(WHITESPACE):
-                if (stack.currentFrame->eptr >= md->end_subject)
+                if (stack.currentFrame->eptr >= md.end_subject)
                     RRETURN_NO_MATCH;
                 GETCHARINCTEST(c, stack.currentFrame->eptr);
-                if (c >= 128 || !(md->ctypes[c] & ctype_space))
+                if (c >= 128 || !(md.ctypes[c] & ctype_space))
                     RRETURN_NO_MATCH;
                 stack.currentFrame->ecode++;
                 NEXT_OPCODE;
                 
                 BEGIN_OPCODE(NOT_WORDCHAR):
-                if (stack.currentFrame->eptr >= md->end_subject)
+                if (stack.currentFrame->eptr >= md.end_subject)
                     RRETURN_NO_MATCH;
                 GETCHARINCTEST(c, stack.currentFrame->eptr);
-                if (c < 128 && (md->ctypes[c] & ctype_word))
+                if (c < 128 && (md.ctypes[c] & ctype_word))
                     RRETURN_NO_MATCH;
                 stack.currentFrame->ecode++;
                 NEXT_OPCODE;
                 
                 BEGIN_OPCODE(WORDCHAR):
-                if (stack.currentFrame->eptr >= md->end_subject)
+                if (stack.currentFrame->eptr >= md.end_subject)
                     RRETURN_NO_MATCH;
                 GETCHARINCTEST(c, stack.currentFrame->eptr);
-                if (c >= 128 || !(md->ctypes[c] & ctype_word))
+                if (c >= 128 || !(md.ctypes[c] & ctype_word))
                     RRETURN_NO_MATCH;
                 stack.currentFrame->ecode++;
                 NEXT_OPCODE;
@@ -881,10 +881,10 @@ RECURSE:
                  can't just fail here, because of the possibility of quantifiers with zero
                  minima. */
                 
-                if (stack.currentFrame->offset >= stack.currentFrame->offset_top || md->offset_vector[stack.currentFrame->offset] < 0)
+                if (stack.currentFrame->offset >= stack.currentFrame->offset_top || md.offset_vector[stack.currentFrame->offset] < 0)
                     stack.currentFrame->length = 0;
                 else
-                    stack.currentFrame->length = md->offset_vector[stack.currentFrame->offset+1] - md->offset_vector[stack.currentFrame->offset];
+                    stack.currentFrame->length = md.offset_vector[stack.currentFrame->offset+1] - md.offset_vector[stack.currentFrame->offset];
                 
                 /* Set up for repetition, or handle the non-repeated case */
                 
@@ -1022,7 +1022,7 @@ RECURSE:
                 /* First, ensure the minimum number of matches are present. */
                 
                 for (i = 1; i <= min; i++) {
-                    if (stack.currentFrame->eptr >= md->end_subject)
+                    if (stack.currentFrame->eptr >= md.end_subject)
                         RRETURN_NO_MATCH;
                     GETCHARINC(c, stack.currentFrame->eptr);
                     if (c > 255) {
@@ -1048,7 +1048,7 @@ RECURSE:
                             RMATCH(22, stack.currentFrame->ecode, stack.currentFrame->eptrb, 0);
                             if (is_match)
                                 RRETURN;
-                            if (stack.currentFrame->fi >= stack.currentFrame->max || stack.currentFrame->eptr >= md->end_subject)
+                            if (stack.currentFrame->fi >= stack.currentFrame->max || stack.currentFrame->eptr >= md.end_subject)
                                 RRETURN;
                             GETCHARINC(c, stack.currentFrame->eptr);
                             if (c > 255) {
@@ -1068,7 +1068,7 @@ RECURSE:
                     
                     for (i = min; i < stack.currentFrame->max; i++) {
                         int len = 1;
-                        if (stack.currentFrame->eptr >= md->end_subject)
+                        if (stack.currentFrame->eptr >= md.end_subject)
                             break;
                         GETCHARLEN(c, stack.currentFrame->eptr, len);
                         if (c > 255) {
@@ -1132,7 +1132,7 @@ RECURSE:
                 /* First, ensure the minimum number of matches are present. */
                 
                 for (i = 1; i <= min; i++) {
-                    if (stack.currentFrame->eptr >= md->end_subject)
+                    if (stack.currentFrame->eptr >= md.end_subject)
                         RRETURN_NO_MATCH;
                     GETCHARINC(c, stack.currentFrame->eptr);
                     if (!_pcre_xclass(c, stack.currentFrame->data))
@@ -1153,7 +1153,7 @@ RECURSE:
                         RMATCH(26, stack.currentFrame->ecode, stack.currentFrame->eptrb, 0);
                         if (is_match)
                             RRETURN;
-                        if (stack.currentFrame->fi >= stack.currentFrame->max || stack.currentFrame->eptr >= md->end_subject)
+                        if (stack.currentFrame->fi >= stack.currentFrame->max || stack.currentFrame->eptr >= md.end_subject)
                             RRETURN;
                         GETCHARINC(c, stack.currentFrame->eptr);
                         if (!_pcre_xclass(c, stack.currentFrame->data))
@@ -1168,7 +1168,7 @@ RECURSE:
                     stack.currentFrame->pp = stack.currentFrame->eptr;
                     for (i = min; i < stack.currentFrame->max; i++) {
                         int len = 1;
-                        if (stack.currentFrame->eptr >= md->end_subject)
+                        if (stack.currentFrame->eptr >= md.end_subject)
                             break;
                         GETCHARLEN(c, stack.currentFrame->eptr, len);
                         if (!_pcre_xclass(c, stack.currentFrame->data))
@@ -1197,7 +1197,7 @@ RECURSE:
             {
                 int dc;
                 stack.currentFrame->ecode += stack.currentFrame->length;
-                switch (md->end_subject - stack.currentFrame->eptr) {
+                switch (md.end_subject - stack.currentFrame->eptr) {
                 case 0:
                     RRETURN_NO_MATCH;
                 case 1:
@@ -1220,12 +1220,12 @@ RECURSE:
                 stack.currentFrame->ecode++;
                 getUTF8CharAndIncrementLength(stack.currentFrame->fc, stack.currentFrame->ecode, stack.currentFrame->length);
                 
-                if (md->end_subject - stack.currentFrame->eptr == 0)
+                if (md.end_subject - stack.currentFrame->eptr == 0)
                     RRETURN_NO_MATCH;
                 
             {
                 int dc;
-                if (md->end_subject - stack.currentFrame->eptr == 1) {
+                if (md.end_subject - stack.currentFrame->eptr == 1) {
                     dc = *stack.currentFrame->eptr++;
                     if (isLeadingSurrogate(dc))
                         RRETURN_NO_MATCH;
@@ -1246,7 +1246,7 @@ RECURSE:
                 /* Match a single ASCII character. */
                 
                 BEGIN_OPCODE(ASCII_CHAR):
-                if (md->end_subject == stack.currentFrame->eptr)
+                if (md.end_subject == stack.currentFrame->eptr)
                     RRETURN_NO_MATCH;
                 if (*stack.currentFrame->eptr != stack.currentFrame->ecode[1])
                     RRETURN_NO_MATCH;
@@ -1257,7 +1257,7 @@ RECURSE:
                 /* Match one of two cases of an ASCII character. */
                 
                 BEGIN_OPCODE(ASCII_LETTER_NC):
-                if (md->end_subject == stack.currentFrame->eptr)
+                if (md.end_subject == stack.currentFrame->eptr)
                     RRETURN_NO_MATCH;
                 if ((*stack.currentFrame->eptr | 0x20) != stack.currentFrame->ecode[1])
                     RRETURN_NO_MATCH;
@@ -1302,12 +1302,12 @@ RECURSE:
                 
                 stack.currentFrame->length = 1;
                 getUTF8CharAndIncrementLength(stack.currentFrame->fc, stack.currentFrame->ecode, stack.currentFrame->length);
-                if (min * (stack.currentFrame->fc > 0xFFFF ? 2 : 1) > md->end_subject - stack.currentFrame->eptr)
+                if (min * (stack.currentFrame->fc > 0xFFFF ? 2 : 1) > md.end_subject - stack.currentFrame->eptr)
                     RRETURN_NO_MATCH;
                 stack.currentFrame->ecode += stack.currentFrame->length;
                 
                 if (stack.currentFrame->fc <= 0xFFFF) {
-                    int othercase = md->caseless ? _pcre_ucp_othercase(stack.currentFrame->fc) : -1;
+                    int othercase = md.caseless ? _pcre_ucp_othercase(stack.currentFrame->fc) : -1;
                     
                     for (i = 1; i <= min; i++) {
                         if (*stack.currentFrame->eptr != stack.currentFrame->fc && *stack.currentFrame->eptr != othercase)
@@ -1324,7 +1324,7 @@ RECURSE:
                             RMATCH(28, stack.currentFrame->ecode, stack.currentFrame->eptrb, 0);
                             if (is_match)
                                 RRETURN;
-                            if (stack.currentFrame->fi >= stack.currentFrame->max || stack.currentFrame->eptr >= md->end_subject)
+                            if (stack.currentFrame->fi >= stack.currentFrame->max || stack.currentFrame->eptr >= md.end_subject)
                                 RRETURN;
                             if (*stack.currentFrame->eptr != stack.currentFrame->fc && *stack.currentFrame->eptr != stack.currentFrame->repeat_othercase)
                                 RRETURN;
@@ -1334,7 +1334,7 @@ RECURSE:
                     } else {
                         stack.currentFrame->pp = stack.currentFrame->eptr;
                         for (i = min; i < stack.currentFrame->max; i++) {
-                            if (stack.currentFrame->eptr >= md->end_subject)
+                            if (stack.currentFrame->eptr >= md.end_subject)
                                 break;
                             if (*stack.currentFrame->eptr != stack.currentFrame->fc && *stack.currentFrame->eptr != othercase)
                                 break;
@@ -1369,7 +1369,7 @@ RECURSE:
                             RMATCH(30, stack.currentFrame->ecode, stack.currentFrame->eptrb, 0);
                             if (is_match)
                                 RRETURN;
-                            if (stack.currentFrame->fi >= stack.currentFrame->max || stack.currentFrame->eptr >= md->end_subject)
+                            if (stack.currentFrame->fi >= stack.currentFrame->max || stack.currentFrame->eptr >= md.end_subject)
                                 RRETURN;
                             getChar(nc, stack.currentFrame->eptr);
                             if (*stack.currentFrame->eptr != stack.currentFrame->fc)
@@ -1381,7 +1381,7 @@ RECURSE:
                         stack.currentFrame->pp = stack.currentFrame->eptr;
                         for (i = min; i < stack.currentFrame->max; i++) {
                             int nc;
-                            if (stack.currentFrame->eptr > md->end_subject - 2)
+                            if (stack.currentFrame->eptr > md.end_subject - 2)
                                 break;
                             getChar(nc, stack.currentFrame->eptr);
                             if (*stack.currentFrame->eptr != stack.currentFrame->fc)
@@ -1404,14 +1404,14 @@ RECURSE:
                  checking can be multibyte. */
                 
                 BEGIN_OPCODE(NOT):
-                if (stack.currentFrame->eptr >= md->end_subject)
+                if (stack.currentFrame->eptr >= md.end_subject)
                     RRETURN_NO_MATCH;
                 stack.currentFrame->ecode++;
                 GETCHARINCTEST(c, stack.currentFrame->eptr);
-                if (md->caseless) {
+                if (md.caseless) {
                     if (c < 128)
-                        c = md->lcc[c];
-                    if (md->lcc[*stack.currentFrame->ecode++] == c)
+                        c = md.lcc[c];
+                    if (md.lcc[*stack.currentFrame->ecode++] == c)
                         RRETURN_NO_MATCH;
                 } else {
                     if (*stack.currentFrame->ecode++ == c)
@@ -1457,7 +1457,7 @@ RECURSE:
                  subject. */
                 
             REPEATNOTCHAR:
-                if (min > md->end_subject - stack.currentFrame->eptr)
+                if (min > md.end_subject - stack.currentFrame->eptr)
                     RRETURN_NO_MATCH;
                 stack.currentFrame->fc = *stack.currentFrame->ecode++;
                 
@@ -1471,16 +1471,16 @@ RECURSE:
                 
                 DPRINTF(("negative matching %c{%d,%d}\n", stack.currentFrame->fc, min, stack.currentFrame->max));
                 
-                if (md->caseless) {
+                if (md.caseless) {
                     if (stack.currentFrame->fc < 128)
-                        stack.currentFrame->fc = md->lcc[stack.currentFrame->fc];
+                        stack.currentFrame->fc = md.lcc[stack.currentFrame->fc];
                     
                     {
                         int d;
                         for (i = 1; i <= min; i++) {
                             GETCHARINC(d, stack.currentFrame->eptr);
                             if (d < 128)
-                                d = md->lcc[d];
+                                d = md.lcc[d];
                             if (stack.currentFrame->fc == d)
                                 RRETURN_NO_MATCH;
                         }
@@ -1497,8 +1497,8 @@ RECURSE:
                                 RRETURN;
                             GETCHARINC(d, stack.currentFrame->eptr);
                             if (d < 128)
-                                d = md->lcc[d];
-                            if (stack.currentFrame->fi >= stack.currentFrame->max || stack.currentFrame->eptr >= md->end_subject || stack.currentFrame->fc == d)
+                                d = md.lcc[d];
+                            if (stack.currentFrame->fi >= stack.currentFrame->max || stack.currentFrame->eptr >= md.end_subject || stack.currentFrame->fc == d)
                                 RRETURN;
                         }
                         /* Control never reaches here */
@@ -1513,11 +1513,11 @@ RECURSE:
                             int d;
                             for (i = min; i < stack.currentFrame->max; i++) {
                                 int len = 1;
-                                if (stack.currentFrame->eptr >= md->end_subject)
+                                if (stack.currentFrame->eptr >= md.end_subject)
                                     break;
                                 GETCHARLEN(d, stack.currentFrame->eptr, len);
                                 if (d < 128)
-                                    d = md->lcc[d];
+                                    d = md.lcc[d];
                                 if (stack.currentFrame->fc == d)
                                     break;
                                 stack.currentFrame->eptr += len;
@@ -1559,7 +1559,7 @@ RECURSE:
                             if (is_match)
                                 RRETURN;
                             GETCHARINC(d, stack.currentFrame->eptr);
-                            if (stack.currentFrame->fi >= stack.currentFrame->max || stack.currentFrame->eptr >= md->end_subject || stack.currentFrame->fc == d)
+                            if (stack.currentFrame->fi >= stack.currentFrame->max || stack.currentFrame->eptr >= md.end_subject || stack.currentFrame->fc == d)
                                 RRETURN;
                         }
                         /* Control never reaches here */
@@ -1574,7 +1574,7 @@ RECURSE:
                             int d;
                             for (i = min; i < stack.currentFrame->max; i++) {
                                 int len = 1;
-                                if (stack.currentFrame->eptr >= md->end_subject)
+                                if (stack.currentFrame->eptr >= md.end_subject)
                                     break;
                                 GETCHARLEN(d, stack.currentFrame->eptr, len);
                                 if (stack.currentFrame->fc == d)
@@ -1642,23 +1642,23 @@ RECURSE:
                  is tidier. Also separate the UCP code, which can be the same for both UTF-8
                  and single-bytes. */
                 
-                if (min > md->end_subject - stack.currentFrame->eptr)
+                if (min > md.end_subject - stack.currentFrame->eptr)
                     RRETURN_NO_MATCH;
                 if (min > 0) {
                     switch(stack.currentFrame->ctype) {
                         case OP_ANY:
                             for (i = 1; i <= min; i++) {
-                                if (stack.currentFrame->eptr >= md->end_subject || isNewline(*stack.currentFrame->eptr))
+                                if (stack.currentFrame->eptr >= md.end_subject || isNewline(*stack.currentFrame->eptr))
                                     RRETURN_NO_MATCH;
                                 ++stack.currentFrame->eptr;
-                                while (stack.currentFrame->eptr < md->end_subject && isTrailingSurrogate(*stack.currentFrame->eptr))
+                                while (stack.currentFrame->eptr < md.end_subject && isTrailingSurrogate(*stack.currentFrame->eptr))
                                     stack.currentFrame->eptr++;
                             }
                             break;
                             
                             case OP_NOT_DIGIT:
                             for (i = 1; i <= min; i++) {
-                                if (stack.currentFrame->eptr >= md->end_subject)
+                                if (stack.currentFrame->eptr >= md.end_subject)
                                     RRETURN_NO_MATCH;
                                 GETCHARINC(c, stack.currentFrame->eptr);
                                 if (isASCIIDigit(c))
@@ -1668,7 +1668,7 @@ RECURSE:
                             
                             case OP_DIGIT:
                             for (i = 1; i <= min; i++) {
-                                if (stack.currentFrame->eptr >= md->end_subject || !isASCIIDigit(*stack.currentFrame->eptr++))
+                                if (stack.currentFrame->eptr >= md.end_subject || !isASCIIDigit(*stack.currentFrame->eptr++))
                                     RRETURN_NO_MATCH;
                                 /* No need to skip more bytes - we know it's a 1-byte character */
                             }
@@ -1676,17 +1676,17 @@ RECURSE:
                             
                             case OP_NOT_WHITESPACE:
                             for (i = 1; i <= min; i++) {
-                                if (stack.currentFrame->eptr >= md->end_subject ||
-                                    (*stack.currentFrame->eptr < 128 && (md->ctypes[*stack.currentFrame->eptr] & ctype_space) != 0))
+                                if (stack.currentFrame->eptr >= md.end_subject ||
+                                    (*stack.currentFrame->eptr < 128 && (md.ctypes[*stack.currentFrame->eptr] & ctype_space) != 0))
                                     RRETURN_NO_MATCH;
-                                while (++stack.currentFrame->eptr < md->end_subject && isTrailingSurrogate(*stack.currentFrame->eptr)) { }
+                                while (++stack.currentFrame->eptr < md.end_subject && isTrailingSurrogate(*stack.currentFrame->eptr)) { }
                             }
                             break;
                             
                             case OP_WHITESPACE:
                             for (i = 1; i <= min; i++) {
-                                if (stack.currentFrame->eptr >= md->end_subject ||
-                                    *stack.currentFrame->eptr >= 128 || (md->ctypes[*stack.currentFrame->eptr++] & ctype_space) == 0)
+                                if (stack.currentFrame->eptr >= md.end_subject ||
+                                    *stack.currentFrame->eptr >= 128 || (md.ctypes[*stack.currentFrame->eptr++] & ctype_space) == 0)
                                     RRETURN_NO_MATCH;
                                 /* No need to skip more bytes - we know it's a 1-byte character */
                             }
@@ -1694,17 +1694,17 @@ RECURSE:
                             
                             case OP_NOT_WORDCHAR:
                             for (i = 1; i <= min; i++) {
-                                if (stack.currentFrame->eptr >= md->end_subject ||
-                                    (*stack.currentFrame->eptr < 128 && (md->ctypes[*stack.currentFrame->eptr] & ctype_word) != 0))
+                                if (stack.currentFrame->eptr >= md.end_subject ||
+                                    (*stack.currentFrame->eptr < 128 && (md.ctypes[*stack.currentFrame->eptr] & ctype_word) != 0))
                                     RRETURN_NO_MATCH;
-                                while (++stack.currentFrame->eptr < md->end_subject && isTrailingSurrogate(*stack.currentFrame->eptr)) { }
+                                while (++stack.currentFrame->eptr < md.end_subject && isTrailingSurrogate(*stack.currentFrame->eptr)) { }
                             }
                             break;
                             
                             case OP_WORDCHAR:
                             for (i = 1; i <= min; i++) {
-                                if (stack.currentFrame->eptr >= md->end_subject ||
-                                    *stack.currentFrame->eptr >= 128 || (md->ctypes[*stack.currentFrame->eptr++] & ctype_word) == 0)
+                                if (stack.currentFrame->eptr >= md.end_subject ||
+                                    *stack.currentFrame->eptr >= 128 || (md.ctypes[*stack.currentFrame->eptr++] & ctype_word) == 0)
                                     RRETURN_NO_MATCH;
                                 /* No need to skip more bytes - we know it's a 1-byte character */
                             }
@@ -1729,7 +1729,7 @@ RECURSE:
                         RMATCH(48, stack.currentFrame->ecode, stack.currentFrame->eptrb, 0);
                         if (is_match)
                             RRETURN;
-                        if (stack.currentFrame->fi >= stack.currentFrame->max || stack.currentFrame->eptr >= md->end_subject)
+                        if (stack.currentFrame->fi >= stack.currentFrame->max || stack.currentFrame->eptr >= md.end_subject)
                             RRETURN;
                         
                         GETCHARINC(c, stack.currentFrame->eptr);
@@ -1750,22 +1750,22 @@ RECURSE:
                             break;
                             
                         case OP_NOT_WHITESPACE:
-                            if (c < 128 && (md->ctypes[c] & ctype_space))
+                            if (c < 128 && (md.ctypes[c] & ctype_space))
                                 RRETURN;
                             break;
                             
                         case OP_WHITESPACE:
-                            if  (c >= 128 || !(md->ctypes[c] & ctype_space))
+                            if  (c >= 128 || !(md.ctypes[c] & ctype_space))
                                 RRETURN;
                             break;
                             
                         case OP_NOT_WORDCHAR:
-                            if (c < 128 && (md->ctypes[c] & ctype_word))
+                            if (c < 128 && (md.ctypes[c] & ctype_word))
                                 RRETURN;
                             break;
                             
                         case OP_WORDCHAR:
-                            if (c >= 128 || !(md->ctypes[c] & ctype_word))
+                            if (c >= 128 || !(md.ctypes[c] & ctype_word))
                                 RRETURN;
                             break;
                             
@@ -1792,10 +1792,10 @@ RECURSE:
                             
                             if (stack.currentFrame->max < INT_MAX) {
                                 for (i = min; i < stack.currentFrame->max; i++) {
-                                    if (stack.currentFrame->eptr >= md->end_subject || isNewline(*stack.currentFrame->eptr))
+                                    if (stack.currentFrame->eptr >= md.end_subject || isNewline(*stack.currentFrame->eptr))
                                         break;
                                     stack.currentFrame->eptr++;
-                                    while (stack.currentFrame->eptr < md->end_subject && (*stack.currentFrame->eptr & 0xc0) == 0x80)
+                                    while (stack.currentFrame->eptr < md.end_subject && (*stack.currentFrame->eptr & 0xc0) == 0x80)
                                         stack.currentFrame->eptr++;
                                 }
                             }
@@ -1804,7 +1804,7 @@ RECURSE:
                             
                             else {
                                 for (i = min; i < stack.currentFrame->max; i++) {
-                                    if (stack.currentFrame->eptr >= md->end_subject || isNewline(*stack.currentFrame->eptr))
+                                    if (stack.currentFrame->eptr >= md.end_subject || isNewline(*stack.currentFrame->eptr))
                                         break;
                                     stack.currentFrame->eptr++;
                                 }
@@ -1815,7 +1815,7 @@ RECURSE:
                             case OP_NOT_DIGIT:
                             for (i = min; i < stack.currentFrame->max; i++) {
                                 int len = 1;
-                                if (stack.currentFrame->eptr >= md->end_subject)
+                                if (stack.currentFrame->eptr >= md.end_subject)
                                     break;
                                 GETCHARLEN(c, stack.currentFrame->eptr, len);
                                 if (isASCIIDigit(c))
@@ -1827,7 +1827,7 @@ RECURSE:
                             case OP_DIGIT:
                             for (i = min; i < stack.currentFrame->max; i++) {
                                 int len = 1;
-                                if (stack.currentFrame->eptr >= md->end_subject)
+                                if (stack.currentFrame->eptr >= md.end_subject)
                                     break;
                                 GETCHARLEN(c, stack.currentFrame->eptr, len);
                                 if (!isASCIIDigit(c))
@@ -1839,10 +1839,10 @@ RECURSE:
                             case OP_NOT_WHITESPACE:
                             for (i = min; i < stack.currentFrame->max; i++) {
                                 int len = 1;
-                                if (stack.currentFrame->eptr >= md->end_subject)
+                                if (stack.currentFrame->eptr >= md.end_subject)
                                     break;
                                 GETCHARLEN(c, stack.currentFrame->eptr, len);
-                                if (c < 128 && (md->ctypes[c] & ctype_space))
+                                if (c < 128 && (md.ctypes[c] & ctype_space))
                                     break;
                                 stack.currentFrame->eptr+= len;
                             }
@@ -1851,10 +1851,10 @@ RECURSE:
                             case OP_WHITESPACE:
                             for (i = min; i < stack.currentFrame->max; i++) {
                                 int len = 1;
-                                if (stack.currentFrame->eptr >= md->end_subject)
+                                if (stack.currentFrame->eptr >= md.end_subject)
                                     break;
                                 GETCHARLEN(c, stack.currentFrame->eptr, len);
-                                if (c >= 128 || !(md->ctypes[c] & ctype_space))
+                                if (c >= 128 || !(md.ctypes[c] & ctype_space))
                                     break;
                                 stack.currentFrame->eptr+= len;
                             }
@@ -1863,10 +1863,10 @@ RECURSE:
                             case OP_NOT_WORDCHAR:
                             for (i = min; i < stack.currentFrame->max; i++) {
                                 int len = 1;
-                                if (stack.currentFrame->eptr >= md->end_subject)
+                                if (stack.currentFrame->eptr >= md.end_subject)
                                     break;
                                 GETCHARLEN(c, stack.currentFrame->eptr, len);
-                                if (c < 128 && (md->ctypes[c] & ctype_word))
+                                if (c < 128 && (md.ctypes[c] & ctype_word))
                                     break;
                                 stack.currentFrame->eptr+= len;
                             }
@@ -1875,10 +1875,10 @@ RECURSE:
                             case OP_WORDCHAR:
                             for (i = min; i < stack.currentFrame->max; i++) {
                                 int len = 1;
-                                if (stack.currentFrame->eptr >= md->end_subject)
+                                if (stack.currentFrame->eptr >= md.end_subject)
                                     break;
                                 GETCHARLEN(c, stack.currentFrame->eptr, len);
-                                if (c >= 128 || !(md->ctypes[c] & ctype_word))
+                                if (c >= 128 || !(md.ctypes[c] & ctype_word))
                                     break;
                                 stack.currentFrame->eptr+= len;
                             }
@@ -1953,13 +1953,13 @@ RECURSE:
                 printf("\n");
 #endif
                 
-                if (stack.currentFrame->offset < md->offset_max) {
-                    stack.currentFrame->save_offset1 = md->offset_vector[stack.currentFrame->offset];
-                    stack.currentFrame->save_offset2 = md->offset_vector[stack.currentFrame->offset + 1];
-                    stack.currentFrame->save_offset3 = md->offset_vector[md->offset_end - stack.currentFrame->number];
+                if (stack.currentFrame->offset < md.offset_max) {
+                    stack.currentFrame->save_offset1 = md.offset_vector[stack.currentFrame->offset];
+                    stack.currentFrame->save_offset2 = md.offset_vector[stack.currentFrame->offset + 1];
+                    stack.currentFrame->save_offset3 = md.offset_vector[md.offset_end - stack.currentFrame->number];
                     
                     DPRINTF(("saving %d %d %d\n", stack.currentFrame->save_offset1, stack.currentFrame->save_offset2, stack.currentFrame->save_offset3));
-                    md->offset_vector[md->offset_end - stack.currentFrame->number] = stack.currentFrame->eptr - md->start_subject;
+                    md.offset_vector[md.offset_end - stack.currentFrame->number] = stack.currentFrame->eptr - md.start_subject;
                     
                     do {
                         RMATCH(1, stack.currentFrame->ecode + 1 + LINK_SIZE, stack.currentFrame->eptrb, match_isgroup);
@@ -1969,9 +1969,9 @@ RECURSE:
                     
                     DPRINTF(("bracket %d failed\n", stack.currentFrame->number));
                     
-                    md->offset_vector[stack.currentFrame->offset] = stack.currentFrame->save_offset1;
-                    md->offset_vector[stack.currentFrame->offset + 1] = stack.currentFrame->save_offset2;
-                    md->offset_vector[md->offset_end - stack.currentFrame->number] = stack.currentFrame->save_offset3;
+                    md.offset_vector[stack.currentFrame->offset] = stack.currentFrame->save_offset1;
+                    md.offset_vector[stack.currentFrame->offset + 1] = stack.currentFrame->save_offset2;
+                    md.offset_vector[md.offset_end - stack.currentFrame->number] = stack.currentFrame->save_offset3;
                     
                     RRETURN;
                 }
@@ -2275,7 +2275,7 @@ int jsRegExpExecute(const JSRegExp* re,
         /* The code starts after the JSRegExp block and the capture name table. */
         const uschar* start_code = (const uschar*)(re + 1);
         
-        int returnCode = match(start_match, start_code, 2, &match_block);
+        int returnCode = match(start_match, start_code, 2, match_block);
         
         /* When the result is no match, if the subject's first character was a
          newline and the PCRE_FIRSTLINE option is set, break (which will return