Ignore:
Timestamp:
Nov 29, 2007, 3:14:21 AM (18 years ago)
Author:
[email protected]
Message:

2007-11-24 Eric Seidel <[email protected]>

Reviewed by Sam.

Pass around MatchData objects by reference

  • pcre/pcre_exec.cpp: (pchars): (match_ref): (match): (jsRegExpExecute):
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/pcre/pcre_exec.cpp

    r28148 r28149  
    160160  p           points to characters
    161161  length      number to print
    162   is_subject  true if printing from within md->start_subject
     162  is_subject  true if printing from within md.start_subject
    163163  md          pointer to matching data block, if is_subject is true
    164164
     
    166166*/
    167167
    168 static void pchars(const UChar* p, int length, bool is_subject, MatchData *md)
     168static void pchars(const UChar* p, int length, bool is_subject, const MatchData& md)
    169169{
    170     if (is_subject && length > md->end_subject - p)
    171         length = md->end_subject - p;
     170    if (is_subject && length > md.end_subject - p)
     171        length = md.end_subject - p;
    172172    while (length-- > 0) {
    173173        int c;
     
    200200*/
    201201
    202 static bool
    203 match_ref(int offset, UChar* eptr, int length, MatchData *md)
     202static bool match_ref(int offset, UChar* eptr, int length, const MatchData& md)
    204203{
    205 UChar* p = md->start_subject + md->offset_vector[offset];
    206 
     204    UChar* p = md.start_subject + md.offset_vector[offset];
     205   
    207206#ifdef DEBUG
    208 if (eptr >= md->end_subject)
    209   printf("matching subject <null>");
    210 else
    211   {
    212   printf("matching subject ");
    213   pchars(eptr, length, true, md);
    214   }
    215 printf(" against backref ");
    216 pchars(p, length, false, md);
    217 printf("\n");
     207    if (eptr >= md.end_subject)
     208        printf("matching subject <null>");
     209    else {
     210        printf("matching subject ");
     211        pchars(eptr, length, true, md);
     212    }
     213    printf(" against backref ");
     214    pchars(p, length, false, md);
     215    printf("\n");
    218216#endif
    219 
    220 /* Always fail if not enough characters left */
    221 
    222 if (length > md->end_subject - eptr) return false;
    223 
    224 /* Separate the caselesss case for speed */
    225 
    226 if (md->caseless)
    227   {
    228   while (length-- > 0)
    229     {
    230     UChar c = *p++;
    231     int othercase = _pcre_ucp_othercase(c);
    232     UChar d = *eptr++;
    233     if (c != d && othercase != d) return false;
     217   
     218    /* Always fail if not enough characters left */
     219   
     220    if (length > md.end_subject - eptr)
     221        return false;
     222   
     223    /* Separate the caselesss case for speed */
     224   
     225    if (md.caseless) {
     226        while (length-- > 0) {
     227            UChar c = *p++;
     228            int othercase = _pcre_ucp_othercase(c);
     229            UChar d = *eptr++;
     230            if (c != d && othercase != d)
     231                return false;
     232        }
    234233    }
    235   }
    236 else
    237   { while (length-- > 0) if (*p++ != *eptr++) return false; }
    238 
    239 return true;
     234    else {
     235        while (length-- > 0)
     236            if (*p++ != *eptr++)
     237                return false;
     238    }
     239   
     240    return true;
    240241}
    241 
    242242
    243243
     
    408408}
    409409
    410 static int match(UChar* eptr, const uschar* ecode, int offset_top, MatchData* md)
     410static int match(UChar* eptr, const uschar* ecode, int offset_top, MatchData& md)
    411411{
    412412    int is_match = false;
     
    464464     haven't exceeded the recursive call limit. */
    465465   
    466     if (md->match_call_count++ >= MATCH_LIMIT)
     466    if (md.match_call_count++ >= MATCH_LIMIT)
    467467        return matchError(JSRegExpErrorMatchLimit, stack);
    468468    if (rdepth >= MATCH_LIMIT_RECURSION)
     
    524524               
    525525                BEGIN_OPCODE(END):
    526                 md->end_match_ptr = stack.currentFrame->eptr;          /* Record where we ended */
    527                 md->end_offset_top = stack.currentFrame->offset_top;   /* and how many extracts were taken */
     526                md.end_match_ptr = stack.currentFrame->eptr;          /* Record where we ended */
     527                md.end_offset_top = stack.currentFrame->offset_top;   /* and how many extracts were taken */
    528528                is_match = true;
    529529                RRETURN;
     
    550550                do stack.currentFrame->ecode += GET(stack.currentFrame->ecode,1); while (*stack.currentFrame->ecode == OP_ALT);
    551551                stack.currentFrame->ecode += 1 + LINK_SIZE;
    552                 stack.currentFrame->offset_top = md->end_offset_top;
     552                stack.currentFrame->offset_top = md.end_offset_top;
    553553                NEXT_OPCODE;
    554554               
     
    594594                do stack.currentFrame->ecode += GET(stack.currentFrame->ecode,1); while (*stack.currentFrame->ecode == OP_ALT);
    595595               
    596                 stack.currentFrame->offset_top = md->end_offset_top;
    597                 stack.currentFrame->eptr = md->end_match_ptr;
     596                stack.currentFrame->offset_top = md.end_offset_top;
     597                stack.currentFrame->eptr = md.end_match_ptr;
    598598               
    599599                /* For a non-repeating ket, just continue at this level. This also
     
    681681               
    682682                if (*stack.currentFrame->prev == OP_ASSERT || *stack.currentFrame->prev == OP_ASSERT_NOT || *stack.currentFrame->prev == OP_ONCE) {
    683                     md->end_match_ptr = stack.currentFrame->eptr;      /* For ONCE */
    684                     md->end_offset_top = stack.currentFrame->offset_top;
     683                    md.end_match_ptr = stack.currentFrame->eptr;      /* For ONCE */
     684                    md.end_offset_top = stack.currentFrame->offset_top;
    685685                    is_match = true;
    686686                    RRETURN;
     
    711711               
    712712                if (stack.currentFrame->number > 0) {
    713                     if (stack.currentFrame->offset >= md->offset_max)
    714                         md->offset_overflow = true;
     713                    if (stack.currentFrame->offset >= md.offset_max)
     714                        md.offset_overflow = true;
    715715                    else {
    716                         md->offset_vector[stack.currentFrame->offset] =
    717                         md->offset_vector[md->offset_end - stack.currentFrame->number];
    718                         md->offset_vector[stack.currentFrame->offset+1] = stack.currentFrame->eptr - md->start_subject;
     716                        md.offset_vector[stack.currentFrame->offset] =
     717                        md.offset_vector[md.offset_end - stack.currentFrame->number];
     718                        md.offset_vector[stack.currentFrame->offset+1] = stack.currentFrame->eptr - md.start_subject;
    719719                        if (stack.currentFrame->offset_top <= stack.currentFrame->offset)
    720720                            stack.currentFrame->offset_top = stack.currentFrame->offset + 2;
     
    756756               
    757757                BEGIN_OPCODE(CIRC):
    758                 if (stack.currentFrame->eptr != md->start_subject && (!md->multiline || !isNewline(stack.currentFrame->eptr[-1])))
     758                if (stack.currentFrame->eptr != md.start_subject && (!md.multiline || !isNewline(stack.currentFrame->eptr[-1])))
    759759                    RRETURN_NO_MATCH;
    760760                stack.currentFrame->ecode++;
     
    764764               
    765765                BEGIN_OPCODE(DOLL):
    766                 if (stack.currentFrame->eptr < md->end_subject && (!md->multiline || !isNewline(*stack.currentFrame->eptr)))
     766                if (stack.currentFrame->eptr < md.end_subject && (!md.multiline || !isNewline(*stack.currentFrame->eptr)))
    767767                    RRETURN_NO_MATCH;
    768768                stack.currentFrame->ecode++;
     
    777777                 be "non-word" characters. */
    778778               
    779                 if (stack.currentFrame->eptr == md->start_subject)
     779                if (stack.currentFrame->eptr == md.start_subject)
    780780                    prev_is_word = false;
    781781                else {
     
    784784                        lastptr--;
    785785                    getChar(c, lastptr);
    786                     prev_is_word = c < 128 && (md->ctypes[c] & ctype_word) != 0;
    787                 }
    788                 if (stack.currentFrame->eptr >= md->end_subject)
     786                    prev_is_word = c < 128 && (md.ctypes[c] & ctype_word) != 0;
     787                }
     788                if (stack.currentFrame->eptr >= md.end_subject)
    789789                    cur_is_word = false;
    790790                else {
    791791                    getChar(c, stack.currentFrame->eptr);
    792                     cur_is_word = c < 128 && (md->ctypes[c] & ctype_word) != 0;
     792                    cur_is_word = c < 128 && (md.ctypes[c] & ctype_word) != 0;
    793793                }
    794794               
     
    802802               
    803803                BEGIN_OPCODE(ANY):
    804                 if (stack.currentFrame->eptr < md->end_subject && isNewline(*stack.currentFrame->eptr))
    805                     RRETURN_NO_MATCH;
    806                 if (stack.currentFrame->eptr++ >= md->end_subject)
    807                     RRETURN_NO_MATCH;
    808                 while (stack.currentFrame->eptr < md->end_subject && isTrailingSurrogate(*stack.currentFrame->eptr))
     804                if (stack.currentFrame->eptr < md.end_subject && isNewline(*stack.currentFrame->eptr))
     805                    RRETURN_NO_MATCH;
     806                if (stack.currentFrame->eptr++ >= md.end_subject)
     807                    RRETURN_NO_MATCH;
     808                while (stack.currentFrame->eptr < md.end_subject && isTrailingSurrogate(*stack.currentFrame->eptr))
    809809                    stack.currentFrame->eptr++;
    810810                stack.currentFrame->ecode++;
     
    812812               
    813813                BEGIN_OPCODE(NOT_DIGIT):
    814                 if (stack.currentFrame->eptr >= md->end_subject)
     814                if (stack.currentFrame->eptr >= md.end_subject)
    815815                    RRETURN_NO_MATCH;
    816816                GETCHARINCTEST(c, stack.currentFrame->eptr);
     
    821821               
    822822                BEGIN_OPCODE(DIGIT):
    823                 if (stack.currentFrame->eptr >= md->end_subject)
     823                if (stack.currentFrame->eptr >= md.end_subject)
    824824                    RRETURN_NO_MATCH;
    825825                GETCHARINCTEST(c, stack.currentFrame->eptr);
     
    830830               
    831831                BEGIN_OPCODE(NOT_WHITESPACE):
    832                 if (stack.currentFrame->eptr >= md->end_subject)
     832                if (stack.currentFrame->eptr >= md.end_subject)
    833833                    RRETURN_NO_MATCH;
    834834                GETCHARINCTEST(c, stack.currentFrame->eptr);
    835                 if (c < 128 && (md->ctypes[c] & ctype_space))
     835                if (c < 128 && (md.ctypes[c] & ctype_space))
    836836                    RRETURN_NO_MATCH;
    837837                stack.currentFrame->ecode++;
     
    839839               
    840840                BEGIN_OPCODE(WHITESPACE):
    841                 if (stack.currentFrame->eptr >= md->end_subject)
     841                if (stack.currentFrame->eptr >= md.end_subject)
    842842                    RRETURN_NO_MATCH;
    843843                GETCHARINCTEST(c, stack.currentFrame->eptr);
    844                 if (c >= 128 || !(md->ctypes[c] & ctype_space))
     844                if (c >= 128 || !(md.ctypes[c] & ctype_space))
    845845                    RRETURN_NO_MATCH;
    846846                stack.currentFrame->ecode++;
     
    848848               
    849849                BEGIN_OPCODE(NOT_WORDCHAR):
    850                 if (stack.currentFrame->eptr >= md->end_subject)
     850                if (stack.currentFrame->eptr >= md.end_subject)
    851851                    RRETURN_NO_MATCH;
    852852                GETCHARINCTEST(c, stack.currentFrame->eptr);
    853                 if (c < 128 && (md->ctypes[c] & ctype_word))
     853                if (c < 128 && (md.ctypes[c] & ctype_word))
    854854                    RRETURN_NO_MATCH;
    855855                stack.currentFrame->ecode++;
     
    857857               
    858858                BEGIN_OPCODE(WORDCHAR):
    859                 if (stack.currentFrame->eptr >= md->end_subject)
     859                if (stack.currentFrame->eptr >= md.end_subject)
    860860                    RRETURN_NO_MATCH;
    861861                GETCHARINCTEST(c, stack.currentFrame->eptr);
    862                 if (c >= 128 || !(md->ctypes[c] & ctype_word))
     862                if (c >= 128 || !(md.ctypes[c] & ctype_word))
    863863                    RRETURN_NO_MATCH;
    864864                stack.currentFrame->ecode++;
     
    882882                 minima. */
    883883               
    884                 if (stack.currentFrame->offset >= stack.currentFrame->offset_top || md->offset_vector[stack.currentFrame->offset] < 0)
     884                if (stack.currentFrame->offset >= stack.currentFrame->offset_top || md.offset_vector[stack.currentFrame->offset] < 0)
    885885                    stack.currentFrame->length = 0;
    886886                else
    887                     stack.currentFrame->length = md->offset_vector[stack.currentFrame->offset+1] - md->offset_vector[stack.currentFrame->offset];
     887                    stack.currentFrame->length = md.offset_vector[stack.currentFrame->offset+1] - md.offset_vector[stack.currentFrame->offset];
    888888               
    889889                /* Set up for repetition, or handle the non-repeated case */
     
    10231023               
    10241024                for (i = 1; i <= min; i++) {
    1025                     if (stack.currentFrame->eptr >= md->end_subject)
     1025                    if (stack.currentFrame->eptr >= md.end_subject)
    10261026                        RRETURN_NO_MATCH;
    10271027                    GETCHARINC(c, stack.currentFrame->eptr);
     
    10491049                            if (is_match)
    10501050                                RRETURN;
    1051                             if (stack.currentFrame->fi >= stack.currentFrame->max || stack.currentFrame->eptr >= md->end_subject)
     1051                            if (stack.currentFrame->fi >= stack.currentFrame->max || stack.currentFrame->eptr >= md.end_subject)
    10521052                                RRETURN;
    10531053                            GETCHARINC(c, stack.currentFrame->eptr);
     
    10691069                    for (i = min; i < stack.currentFrame->max; i++) {
    10701070                        int len = 1;
    1071                         if (stack.currentFrame->eptr >= md->end_subject)
     1071                        if (stack.currentFrame->eptr >= md.end_subject)
    10721072                            break;
    10731073                        GETCHARLEN(c, stack.currentFrame->eptr, len);
     
    11331133               
    11341134                for (i = 1; i <= min; i++) {
    1135                     if (stack.currentFrame->eptr >= md->end_subject)
     1135                    if (stack.currentFrame->eptr >= md.end_subject)
    11361136                        RRETURN_NO_MATCH;
    11371137                    GETCHARINC(c, stack.currentFrame->eptr);
     
    11541154                        if (is_match)
    11551155                            RRETURN;
    1156                         if (stack.currentFrame->fi >= stack.currentFrame->max || stack.currentFrame->eptr >= md->end_subject)
     1156                        if (stack.currentFrame->fi >= stack.currentFrame->max || stack.currentFrame->eptr >= md.end_subject)
    11571157                            RRETURN;
    11581158                        GETCHARINC(c, stack.currentFrame->eptr);
     
    11691169                    for (i = min; i < stack.currentFrame->max; i++) {
    11701170                        int len = 1;
    1171                         if (stack.currentFrame->eptr >= md->end_subject)
     1171                        if (stack.currentFrame->eptr >= md.end_subject)
    11721172                            break;
    11731173                        GETCHARLEN(c, stack.currentFrame->eptr, len);
     
    11981198                int dc;
    11991199                stack.currentFrame->ecode += stack.currentFrame->length;
    1200                 switch (md->end_subject - stack.currentFrame->eptr) {
     1200                switch (md.end_subject - stack.currentFrame->eptr) {
    12011201                case 0:
    12021202                    RRETURN_NO_MATCH;
     
    12211221                getUTF8CharAndIncrementLength(stack.currentFrame->fc, stack.currentFrame->ecode, stack.currentFrame->length);
    12221222               
    1223                 if (md->end_subject - stack.currentFrame->eptr == 0)
     1223                if (md.end_subject - stack.currentFrame->eptr == 0)
    12241224                    RRETURN_NO_MATCH;
    12251225               
    12261226            {
    12271227                int dc;
    1228                 if (md->end_subject - stack.currentFrame->eptr == 1) {
     1228                if (md.end_subject - stack.currentFrame->eptr == 1) {
    12291229                    dc = *stack.currentFrame->eptr++;
    12301230                    if (isLeadingSurrogate(dc))
     
    12471247               
    12481248                BEGIN_OPCODE(ASCII_CHAR):
    1249                 if (md->end_subject == stack.currentFrame->eptr)
     1249                if (md.end_subject == stack.currentFrame->eptr)
    12501250                    RRETURN_NO_MATCH;
    12511251                if (*stack.currentFrame->eptr != stack.currentFrame->ecode[1])
     
    12581258               
    12591259                BEGIN_OPCODE(ASCII_LETTER_NC):
    1260                 if (md->end_subject == stack.currentFrame->eptr)
     1260                if (md.end_subject == stack.currentFrame->eptr)
    12611261                    RRETURN_NO_MATCH;
    12621262                if ((*stack.currentFrame->eptr | 0x20) != stack.currentFrame->ecode[1])
     
    13031303                stack.currentFrame->length = 1;
    13041304                getUTF8CharAndIncrementLength(stack.currentFrame->fc, stack.currentFrame->ecode, stack.currentFrame->length);
    1305                 if (min * (stack.currentFrame->fc > 0xFFFF ? 2 : 1) > md->end_subject - stack.currentFrame->eptr)
     1305                if (min * (stack.currentFrame->fc > 0xFFFF ? 2 : 1) > md.end_subject - stack.currentFrame->eptr)
    13061306                    RRETURN_NO_MATCH;
    13071307                stack.currentFrame->ecode += stack.currentFrame->length;
    13081308               
    13091309                if (stack.currentFrame->fc <= 0xFFFF) {
    1310                     int othercase = md->caseless ? _pcre_ucp_othercase(stack.currentFrame->fc) : -1;
     1310                    int othercase = md.caseless ? _pcre_ucp_othercase(stack.currentFrame->fc) : -1;
    13111311                   
    13121312                    for (i = 1; i <= min; i++) {
     
    13251325                            if (is_match)
    13261326                                RRETURN;
    1327                             if (stack.currentFrame->fi >= stack.currentFrame->max || stack.currentFrame->eptr >= md->end_subject)
     1327                            if (stack.currentFrame->fi >= stack.currentFrame->max || stack.currentFrame->eptr >= md.end_subject)
    13281328                                RRETURN;
    13291329                            if (*stack.currentFrame->eptr != stack.currentFrame->fc && *stack.currentFrame->eptr != stack.currentFrame->repeat_othercase)
     
    13351335                        stack.currentFrame->pp = stack.currentFrame->eptr;
    13361336                        for (i = min; i < stack.currentFrame->max; i++) {
    1337                             if (stack.currentFrame->eptr >= md->end_subject)
     1337                            if (stack.currentFrame->eptr >= md.end_subject)
    13381338                                break;
    13391339                            if (*stack.currentFrame->eptr != stack.currentFrame->fc && *stack.currentFrame->eptr != othercase)
     
    13701370                            if (is_match)
    13711371                                RRETURN;
    1372                             if (stack.currentFrame->fi >= stack.currentFrame->max || stack.currentFrame->eptr >= md->end_subject)
     1372                            if (stack.currentFrame->fi >= stack.currentFrame->max || stack.currentFrame->eptr >= md.end_subject)
    13731373                                RRETURN;
    13741374                            getChar(nc, stack.currentFrame->eptr);
     
    13821382                        for (i = min; i < stack.currentFrame->max; i++) {
    13831383                            int nc;
    1384                             if (stack.currentFrame->eptr > md->end_subject - 2)
     1384                            if (stack.currentFrame->eptr > md.end_subject - 2)
    13851385                                break;
    13861386                            getChar(nc, stack.currentFrame->eptr);
     
    14051405               
    14061406                BEGIN_OPCODE(NOT):
    1407                 if (stack.currentFrame->eptr >= md->end_subject)
     1407                if (stack.currentFrame->eptr >= md.end_subject)
    14081408                    RRETURN_NO_MATCH;
    14091409                stack.currentFrame->ecode++;
    14101410                GETCHARINCTEST(c, stack.currentFrame->eptr);
    1411                 if (md->caseless) {
     1411                if (md.caseless) {
    14121412                    if (c < 128)
    1413                         c = md->lcc[c];
    1414                     if (md->lcc[*stack.currentFrame->ecode++] == c)
     1413                        c = md.lcc[c];
     1414                    if (md.lcc[*stack.currentFrame->ecode++] == c)
    14151415                        RRETURN_NO_MATCH;
    14161416                } else {
     
    14581458               
    14591459            REPEATNOTCHAR:
    1460                 if (min > md->end_subject - stack.currentFrame->eptr)
     1460                if (min > md.end_subject - stack.currentFrame->eptr)
    14611461                    RRETURN_NO_MATCH;
    14621462                stack.currentFrame->fc = *stack.currentFrame->ecode++;
     
    14721472                DPRINTF(("negative matching %c{%d,%d}\n", stack.currentFrame->fc, min, stack.currentFrame->max));
    14731473               
    1474                 if (md->caseless) {
     1474                if (md.caseless) {
    14751475                    if (stack.currentFrame->fc < 128)
    1476                         stack.currentFrame->fc = md->lcc[stack.currentFrame->fc];
     1476                        stack.currentFrame->fc = md.lcc[stack.currentFrame->fc];
    14771477                   
    14781478                    {
     
    14811481                            GETCHARINC(d, stack.currentFrame->eptr);
    14821482                            if (d < 128)
    1483                                 d = md->lcc[d];
     1483                                d = md.lcc[d];
    14841484                            if (stack.currentFrame->fc == d)
    14851485                                RRETURN_NO_MATCH;
     
    14981498                            GETCHARINC(d, stack.currentFrame->eptr);
    14991499                            if (d < 128)
    1500                                 d = md->lcc[d];
    1501                             if (stack.currentFrame->fi >= stack.currentFrame->max || stack.currentFrame->eptr >= md->end_subject || stack.currentFrame->fc == d)
     1500                                d = md.lcc[d];
     1501                            if (stack.currentFrame->fi >= stack.currentFrame->max || stack.currentFrame->eptr >= md.end_subject || stack.currentFrame->fc == d)
    15021502                                RRETURN;
    15031503                        }
     
    15141514                            for (i = min; i < stack.currentFrame->max; i++) {
    15151515                                int len = 1;
    1516                                 if (stack.currentFrame->eptr >= md->end_subject)
     1516                                if (stack.currentFrame->eptr >= md.end_subject)
    15171517                                    break;
    15181518                                GETCHARLEN(d, stack.currentFrame->eptr, len);
    15191519                                if (d < 128)
    1520                                     d = md->lcc[d];
     1520                                    d = md.lcc[d];
    15211521                                if (stack.currentFrame->fc == d)
    15221522                                    break;
     
    15601560                                RRETURN;
    15611561                            GETCHARINC(d, stack.currentFrame->eptr);
    1562                             if (stack.currentFrame->fi >= stack.currentFrame->max || stack.currentFrame->eptr >= md->end_subject || stack.currentFrame->fc == d)
     1562                            if (stack.currentFrame->fi >= stack.currentFrame->max || stack.currentFrame->eptr >= md.end_subject || stack.currentFrame->fc == d)
    15631563                                RRETURN;
    15641564                        }
     
    15751575                            for (i = min; i < stack.currentFrame->max; i++) {
    15761576                                int len = 1;
    1577                                 if (stack.currentFrame->eptr >= md->end_subject)
     1577                                if (stack.currentFrame->eptr >= md.end_subject)
    15781578                                    break;
    15791579                                GETCHARLEN(d, stack.currentFrame->eptr, len);
     
    16431643                 and single-bytes. */
    16441644               
    1645                 if (min > md->end_subject - stack.currentFrame->eptr)
     1645                if (min > md.end_subject - stack.currentFrame->eptr)
    16461646                    RRETURN_NO_MATCH;
    16471647                if (min > 0) {
     
    16491649                        case OP_ANY:
    16501650                            for (i = 1; i <= min; i++) {
    1651                                 if (stack.currentFrame->eptr >= md->end_subject || isNewline(*stack.currentFrame->eptr))
     1651                                if (stack.currentFrame->eptr >= md.end_subject || isNewline(*stack.currentFrame->eptr))
    16521652                                    RRETURN_NO_MATCH;
    16531653                                ++stack.currentFrame->eptr;
    1654                                 while (stack.currentFrame->eptr < md->end_subject && isTrailingSurrogate(*stack.currentFrame->eptr))
     1654                                while (stack.currentFrame->eptr < md.end_subject && isTrailingSurrogate(*stack.currentFrame->eptr))
    16551655                                    stack.currentFrame->eptr++;
    16561656                            }
     
    16591659                            case OP_NOT_DIGIT:
    16601660                            for (i = 1; i <= min; i++) {
    1661                                 if (stack.currentFrame->eptr >= md->end_subject)
     1661                                if (stack.currentFrame->eptr >= md.end_subject)
    16621662                                    RRETURN_NO_MATCH;
    16631663                                GETCHARINC(c, stack.currentFrame->eptr);
     
    16691669                            case OP_DIGIT:
    16701670                            for (i = 1; i <= min; i++) {
    1671                                 if (stack.currentFrame->eptr >= md->end_subject || !isASCIIDigit(*stack.currentFrame->eptr++))
     1671                                if (stack.currentFrame->eptr >= md.end_subject || !isASCIIDigit(*stack.currentFrame->eptr++))
    16721672                                    RRETURN_NO_MATCH;
    16731673                                /* No need to skip more bytes - we know it's a 1-byte character */
     
    16771677                            case OP_NOT_WHITESPACE:
    16781678                            for (i = 1; i <= min; i++) {
    1679                                 if (stack.currentFrame->eptr >= md->end_subject ||
    1680                                     (*stack.currentFrame->eptr < 128 && (md->ctypes[*stack.currentFrame->eptr] & ctype_space) != 0))
     1679                                if (stack.currentFrame->eptr >= md.end_subject ||
     1680                                    (*stack.currentFrame->eptr < 128 && (md.ctypes[*stack.currentFrame->eptr] & ctype_space) != 0))
    16811681                                    RRETURN_NO_MATCH;
    1682                                 while (++stack.currentFrame->eptr < md->end_subject && isTrailingSurrogate(*stack.currentFrame->eptr)) { }
     1682                                while (++stack.currentFrame->eptr < md.end_subject && isTrailingSurrogate(*stack.currentFrame->eptr)) { }
    16831683                            }
    16841684                            break;
     
    16861686                            case OP_WHITESPACE:
    16871687                            for (i = 1; i <= min; i++) {
    1688                                 if (stack.currentFrame->eptr >= md->end_subject ||
    1689                                     *stack.currentFrame->eptr >= 128 || (md->ctypes[*stack.currentFrame->eptr++] & ctype_space) == 0)
     1688                                if (stack.currentFrame->eptr >= md.end_subject ||
     1689                                    *stack.currentFrame->eptr >= 128 || (md.ctypes[*stack.currentFrame->eptr++] & ctype_space) == 0)
    16901690                                    RRETURN_NO_MATCH;
    16911691                                /* No need to skip more bytes - we know it's a 1-byte character */
     
    16951695                            case OP_NOT_WORDCHAR:
    16961696                            for (i = 1; i <= min; i++) {
    1697                                 if (stack.currentFrame->eptr >= md->end_subject ||
    1698                                     (*stack.currentFrame->eptr < 128 && (md->ctypes[*stack.currentFrame->eptr] & ctype_word) != 0))
     1697                                if (stack.currentFrame->eptr >= md.end_subject ||
     1698                                    (*stack.currentFrame->eptr < 128 && (md.ctypes[*stack.currentFrame->eptr] & ctype_word) != 0))
    16991699                                    RRETURN_NO_MATCH;
    1700                                 while (++stack.currentFrame->eptr < md->end_subject && isTrailingSurrogate(*stack.currentFrame->eptr)) { }
     1700                                while (++stack.currentFrame->eptr < md.end_subject && isTrailingSurrogate(*stack.currentFrame->eptr)) { }
    17011701                            }
    17021702                            break;
     
    17041704                            case OP_WORDCHAR:
    17051705                            for (i = 1; i <= min; i++) {
    1706                                 if (stack.currentFrame->eptr >= md->end_subject ||
    1707                                     *stack.currentFrame->eptr >= 128 || (md->ctypes[*stack.currentFrame->eptr++] & ctype_word) == 0)
     1706                                if (stack.currentFrame->eptr >= md.end_subject ||
     1707                                    *stack.currentFrame->eptr >= 128 || (md.ctypes[*stack.currentFrame->eptr++] & ctype_word) == 0)
    17081708                                    RRETURN_NO_MATCH;
    17091709                                /* No need to skip more bytes - we know it's a 1-byte character */
     
    17301730                        if (is_match)
    17311731                            RRETURN;
    1732                         if (stack.currentFrame->fi >= stack.currentFrame->max || stack.currentFrame->eptr >= md->end_subject)
     1732                        if (stack.currentFrame->fi >= stack.currentFrame->max || stack.currentFrame->eptr >= md.end_subject)
    17331733                            RRETURN;
    17341734                       
     
    17511751                           
    17521752                        case OP_NOT_WHITESPACE:
    1753                             if (c < 128 && (md->ctypes[c] & ctype_space))
     1753                            if (c < 128 && (md.ctypes[c] & ctype_space))
    17541754                                RRETURN;
    17551755                            break;
    17561756                           
    17571757                        case OP_WHITESPACE:
    1758                             if  (c >= 128 || !(md->ctypes[c] & ctype_space))
     1758                            if  (c >= 128 || !(md.ctypes[c] & ctype_space))
    17591759                                RRETURN;
    17601760                            break;
    17611761                           
    17621762                        case OP_NOT_WORDCHAR:
    1763                             if (c < 128 && (md->ctypes[c] & ctype_word))
     1763                            if (c < 128 && (md.ctypes[c] & ctype_word))
    17641764                                RRETURN;
    17651765                            break;
    17661766                           
    17671767                        case OP_WORDCHAR:
    1768                             if (c >= 128 || !(md->ctypes[c] & ctype_word))
     1768                            if (c >= 128 || !(md.ctypes[c] & ctype_word))
    17691769                                RRETURN;
    17701770                            break;
     
    17931793                            if (stack.currentFrame->max < INT_MAX) {
    17941794                                for (i = min; i < stack.currentFrame->max; i++) {
    1795                                     if (stack.currentFrame->eptr >= md->end_subject || isNewline(*stack.currentFrame->eptr))
     1795                                    if (stack.currentFrame->eptr >= md.end_subject || isNewline(*stack.currentFrame->eptr))
    17961796                                        break;
    17971797                                    stack.currentFrame->eptr++;
    1798                                     while (stack.currentFrame->eptr < md->end_subject && (*stack.currentFrame->eptr & 0xc0) == 0x80)
     1798                                    while (stack.currentFrame->eptr < md.end_subject && (*stack.currentFrame->eptr & 0xc0) == 0x80)
    17991799                                        stack.currentFrame->eptr++;
    18001800                                }
     
    18051805                            else {
    18061806                                for (i = min; i < stack.currentFrame->max; i++) {
    1807                                     if (stack.currentFrame->eptr >= md->end_subject || isNewline(*stack.currentFrame->eptr))
     1807                                    if (stack.currentFrame->eptr >= md.end_subject || isNewline(*stack.currentFrame->eptr))
    18081808                                        break;
    18091809                                    stack.currentFrame->eptr++;
     
    18161816                            for (i = min; i < stack.currentFrame->max; i++) {
    18171817                                int len = 1;
    1818                                 if (stack.currentFrame->eptr >= md->end_subject)
     1818                                if (stack.currentFrame->eptr >= md.end_subject)
    18191819                                    break;
    18201820                                GETCHARLEN(c, stack.currentFrame->eptr, len);
     
    18281828                            for (i = min; i < stack.currentFrame->max; i++) {
    18291829                                int len = 1;
    1830                                 if (stack.currentFrame->eptr >= md->end_subject)
     1830                                if (stack.currentFrame->eptr >= md.end_subject)
    18311831                                    break;
    18321832                                GETCHARLEN(c, stack.currentFrame->eptr, len);
     
    18401840                            for (i = min; i < stack.currentFrame->max; i++) {
    18411841                                int len = 1;
    1842                                 if (stack.currentFrame->eptr >= md->end_subject)
     1842                                if (stack.currentFrame->eptr >= md.end_subject)
    18431843                                    break;
    18441844                                GETCHARLEN(c, stack.currentFrame->eptr, len);
    1845                                 if (c < 128 && (md->ctypes[c] & ctype_space))
     1845                                if (c < 128 && (md.ctypes[c] & ctype_space))
    18461846                                    break;
    18471847                                stack.currentFrame->eptr+= len;
     
    18521852                            for (i = min; i < stack.currentFrame->max; i++) {
    18531853                                int len = 1;
    1854                                 if (stack.currentFrame->eptr >= md->end_subject)
     1854                                if (stack.currentFrame->eptr >= md.end_subject)
    18551855                                    break;
    18561856                                GETCHARLEN(c, stack.currentFrame->eptr, len);
    1857                                 if (c >= 128 || !(md->ctypes[c] & ctype_space))
     1857                                if (c >= 128 || !(md.ctypes[c] & ctype_space))
    18581858                                    break;
    18591859                                stack.currentFrame->eptr+= len;
     
    18641864                            for (i = min; i < stack.currentFrame->max; i++) {
    18651865                                int len = 1;
    1866                                 if (stack.currentFrame->eptr >= md->end_subject)
     1866                                if (stack.currentFrame->eptr >= md.end_subject)
    18671867                                    break;
    18681868                                GETCHARLEN(c, stack.currentFrame->eptr, len);
    1869                                 if (c < 128 && (md->ctypes[c] & ctype_word))
     1869                                if (c < 128 && (md.ctypes[c] & ctype_word))
    18701870                                    break;
    18711871                                stack.currentFrame->eptr+= len;
     
    18761876                            for (i = min; i < stack.currentFrame->max; i++) {
    18771877                                int len = 1;
    1878                                 if (stack.currentFrame->eptr >= md->end_subject)
     1878                                if (stack.currentFrame->eptr >= md.end_subject)
    18791879                                    break;
    18801880                                GETCHARLEN(c, stack.currentFrame->eptr, len);
    1881                                 if (c >= 128 || !(md->ctypes[c] & ctype_word))
     1881                                if (c >= 128 || !(md.ctypes[c] & ctype_word))
    18821882                                    break;
    18831883                                stack.currentFrame->eptr+= len;
     
    19541954#endif
    19551955               
    1956                 if (stack.currentFrame->offset < md->offset_max) {
    1957                     stack.currentFrame->save_offset1 = md->offset_vector[stack.currentFrame->offset];
    1958                     stack.currentFrame->save_offset2 = md->offset_vector[stack.currentFrame->offset + 1];
    1959                     stack.currentFrame->save_offset3 = md->offset_vector[md->offset_end - stack.currentFrame->number];
     1956                if (stack.currentFrame->offset < md.offset_max) {
     1957                    stack.currentFrame->save_offset1 = md.offset_vector[stack.currentFrame->offset];
     1958                    stack.currentFrame->save_offset2 = md.offset_vector[stack.currentFrame->offset + 1];
     1959                    stack.currentFrame->save_offset3 = md.offset_vector[md.offset_end - stack.currentFrame->number];
    19601960                   
    19611961                    DPRINTF(("saving %d %d %d\n", stack.currentFrame->save_offset1, stack.currentFrame->save_offset2, stack.currentFrame->save_offset3));
    1962                     md->offset_vector[md->offset_end - stack.currentFrame->number] = stack.currentFrame->eptr - md->start_subject;
     1962                    md.offset_vector[md.offset_end - stack.currentFrame->number] = stack.currentFrame->eptr - md.start_subject;
    19631963                   
    19641964                    do {
     
    19701970                    DPRINTF(("bracket %d failed\n", stack.currentFrame->number));
    19711971                   
    1972                     md->offset_vector[stack.currentFrame->offset] = stack.currentFrame->save_offset1;
    1973                     md->offset_vector[stack.currentFrame->offset + 1] = stack.currentFrame->save_offset2;
    1974                     md->offset_vector[md->offset_end - stack.currentFrame->number] = stack.currentFrame->save_offset3;
     1972                    md.offset_vector[stack.currentFrame->offset] = stack.currentFrame->save_offset1;
     1973                    md.offset_vector[stack.currentFrame->offset + 1] = stack.currentFrame->save_offset2;
     1974                    md.offset_vector[md.offset_end - stack.currentFrame->number] = stack.currentFrame->save_offset3;
    19751975                   
    19761976                    RRETURN;
     
    22762276        const uschar* start_code = (const uschar*)(re + 1);
    22772277       
    2278         int returnCode = match(start_match, start_code, 2, &match_block);
     2278        int returnCode = match(start_match, start_code, 2, match_block);
    22792279       
    22802280        /* When the result is no match, if the subject's first character was a
Note: See TracChangeset for help on using the changeset viewer.