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

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

Reviewed by Maciej.

Remove register keyword and more cleanup

  • pcre/pcre_compile.cpp: (find_fixedlength): (compile_branch): (is_anchored): (is_startline): (find_firstassertedchar): (calculateCompiledPatternLengthAndFlags): (jsRegExpCompile):
  • pcre/pcre_exec.cpp: (MatchStack::canUseStackBufferForNextFrame): (MatchStack::allocateNextFrame): (MatchStack::pushNewFrame): (MatchStack::frameIsStackAllocated): (MatchStack::popCurrentFrame): (MatchStack::unrollAnyHeapAllocatedFrames): (getUTF8CharAndIncrementLength): (match): (jsRegExpExecute):
  • pcre/pcre_internal.h: (PUT2INC): (isLeadingSurrogate): (isTrailingSurrogate): (decodeSurrogatePair): (getChar):
  • pcre/pcre_ord2utf8.cpp: (_pcre_ord2utf8):
  • pcre/pcre_xclass.cpp: (getUTF8CharAndAdvancePointer): (_pcre_xclass):
File:
1 edited

Legend:

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

    r28138 r28139  
    469469int length = -1;
    470470
    471 register int branchlength = 0;
    472 register uschar *cc = code + 1 + LINK_SIZE;
     471int branchlength = 0;
     472uschar *cc = code + 1 + LINK_SIZE;
    473473
    474474/* Scan along the opcodes for this branch. If we get to the end of the
     
    478478  {
    479479  int d;
    480   register int op = *cc;
     480  int op = *cc;
    481481  if (op >= OP_BRA) op = OP_BRA;
    482482
     
    630630could_be_empty_branch(const uschar *code, const uschar *endcode)
    631631{
    632 register int c;
     632int c;
    633633for (code = first_significant_code(code + 1 + LINK_SIZE, true);
    634634     code < endcode;
     
    848848int req_caseopt, reqvary, tempreqvary;
    849849int after_manual_callout = 0;
    850 register int c;
    851 register uschar *code = *codeptr;
     850int c;
     851uschar *code = *codeptr;
    852852uschar *tempcode;
    853853BOOL groupsetfirstbyte = false;
     
    10331033        if (c < 0)
    10341034          {
    1035           register const uschar *cbits = cd->cbits;
     1035          const uschar *cbits = cd->cbits;
    10361036          class_charcount += 2;     /* Greater than 1 is what matters */
    10371037          switch (-c)
     
    11161116        the pre-pass. Optimize one-character ranges */
    11171117
    1118         if (d == c) goto LONE_SINGLE_CHARACTER;  /* A few lines below */
     1118        if (d == c)
     1119            goto LONE_SINGLE_CHARACTER;  /* A few lines below */
    11191120
    11201121        /* In UTF-8 mode, if the upper limit is > 255, or > 127 for caseless
     
    16131614    else if (*previous >= OP_BRA || *previous == OP_ONCE)
    16141615      {
    1615       register int i;
     1616      int i;
    16161617      int ketoffset = 0;
    16171618      int len = code - previous;
     
    16261627      if (repeat_max == -1)
    16271628        {
    1628         register uschar *ket = previous;
     1629        uschar *ket = previous;
    16291630        do ket += GET(ket, 1); while (*ket != OP_KET);
    16301631        ketoffset = code - ket;
     
    18341835
    18351836    /* Process nested bracketed re. Assertions may not be repeated, but other
    1836     kinds can be. We copy code into a non-register variable in order to be able
     1837    kinds can be. We copy code into a non-variable in order to be able
    18371838    to pass its address because some compilers complain otherwise. Pass in a
    18381839    new setting for the ims options if they have changed. */
     
    22392240
    22402241static BOOL
    2241 is_anchored(register const uschar *code, int options, unsigned int bracket_map,
     2242is_anchored(const uschar *code, int options, unsigned int bracket_map,
    22422243  unsigned int backref_map)
    22432244{
     
    22452246   const uschar *scode =
    22462247     first_significant_code(code + 1+LINK_SIZE, false);
    2247    register int op = *scode;
     2248   int op = *scode;
    22482249
    22492250   /* Capturing brackets */
     
    23042305do {
    23052306   const uschar *scode = first_significant_code(code + 1+LINK_SIZE, false);
    2306    register int op = *scode;
     2307   int op = *scode;
    23072308
    23082309   /* Capturing brackets */
     
    23672368find_firstassertedchar(const uschar *code, int options, BOOL inassert)
    23682369{
    2369 register int c = -1;
     2370int c = -1;
    23702371do {
    23712372   int d;
    23722373   const uschar *scode =
    23732374     first_significant_code(code + 1+LINK_SIZE, true);
    2374    register int op = *scode;
     2375   int op = *scode;
    23752376
    23762377   if (op >= OP_BRA) op = OP_BRA;
     
    26792680                                 another byte in the UTF-8 representation. */
    26802681                               
    2681                                 if (ignoreCase)
    2682                                 {
     2682                                if (ignoreCase) {
    26832683                                    int occ, ocd;
    26842684                                    int cc = c;
    26852685                                    int origd = d;
    2686                                     while (get_othercase_range(&cc, origd, &occ, &ocd))
    2687                                     {
     2686                                    while (get_othercase_range(&cc, origd, &occ, &ocd)) {
    26882687                                        if (occ >= c && ocd <= d) continue;   /* Skip embedded */
    26892688                                       
     
    27182717                         support. */
    27192718                       
    2720                         else
    2721                         {
    2722                             if ((c > 255 || (ignoreCase && c > 127)))
    2723                             {
     2719                        else {
     2720                            if ((c > 255 || (ignoreCase && c > 127))) {
    27242721                                uschar buffer[6];
    27252722                                class_optcount = 10;     /* Ensure > 1 */
     
    27452742                 code. Here, we handle repeats for the class opcodes. */
    27462743               
    2747                 if (class_optcount == 1) length += 3; else
    2748                 {
     2744                if (class_optcount == 1)
     2745                    length += 3;
     2746                else {
    27492747                    length += 33;
    27502748                   
     
    27522750                     we also need extra for wrapping the whole thing in a sub-pattern. */
    27532751                   
    2754                     if (ptr + 1 < patternEnd && ptr[1] == '{' && is_counted_repeat(ptr+2, patternEnd))
    2755                     {
     2752                    if (ptr + 1 < patternEnd && ptr[1] == '{' && is_counted_repeat(ptr+2, patternEnd)) {
    27562753                        ptr = read_repeat_counts(ptr+2, &min, &max, &errorcode);
    27572754                        if (errorcode != 0) return -1;;
     
    27592756                            (min == 1 && max == -1))
    27602757                            length++;
    2761                         else length += 5;
    2762                         if (ptr + 1 < patternEnd && ptr[1] == '+')
    2763                         {
     2758                        else
     2759                            length += 5;
     2760                        if (ptr + 1 < patternEnd && ptr[1] == '+') {
    27642761                            ptr++;
    27652762                            length += 2 + 2*LINK_SIZE;
    2766                         }
    2767                         else if (ptr + 1 < patternEnd && ptr[1] == '?') ptr++;
     2763                        } else if (ptr + 1 < patternEnd && ptr[1] == '?')
     2764                            ptr++;
    27682765                    }
    27692766                }
     
    27792776                /* Handle special forms of bracket, which all start (? */
    27802777               
    2781                 if (ptr + 1 < patternEnd && ptr[1] == '?')
    2782                 {
    2783                     switch (c = (ptr + 2 < patternEnd ? ptr[2] : 0))
    2784                     {
     2778                if (ptr + 1 < patternEnd && ptr[1] == '?') {
     2779                    switch (c = (ptr + 2 < patternEnd ? ptr[2] : 0)) {
    27852780                            /* Non-referencing groups and lookaheads just move the pointer on, and
    27862781                             then behave like a non-special bracket, except that they don't increment
     
    28432838                case ')':
    28442839                length += 1 + LINK_SIZE;
    2845                 if (brastackptr > 0)
    2846                 {
     2840                if (brastackptr > 0) {
    28472841                    duplength = length - brastack[--brastackptr];
    28482842                    branch_extra = bralenstack[brastackptr];
    28492843                }
    2850                 else duplength = 0;
     2844                else
     2845                    duplength = 0;
    28512846               
    28522847                /* Leave ptr at the final char; for read_repeat_counts this happens
    28532848                 automatically; for the others we need an increment. */
    28542849               
    2855                 if (ptr + 1 < patternEnd && (c = ptr[1]) == '{' && is_counted_repeat(ptr+2, patternEnd))
    2856                 {
     2850                if (ptr + 1 < patternEnd && (c = ptr[1]) == '{' && is_counted_repeat(ptr+2, patternEnd)) {
    28572851                    ptr = read_repeat_counts(ptr+2, &min, &max, &errorcode);
    28582852                    if (errorcode != 0) return -1;;
     
    28682862                 bracket set. */
    28692863               
    2870                 if (min == 0)
    2871                 {
     2864                if (min == 0) {
    28722865                    length++;
    28732866                    if (max > 0) length += (max - 1) * (duplength + 3 + 2*LINK_SIZE);
     
    28802873                 but one of the optional copies. */
    28812874               
    2882                 else
    2883                 {
     2875                else {
    28842876                    length += (min - 1) * duplength;
    28852877                    if (max > min)   /* Need this test as max=-1 means no limit */
     
    28902882                /* Allow space for once brackets for "possessive quantifier" */
    28912883               
    2892                 if (ptr + 1 < patternEnd && ptr[1] == '+')
    2893                 {
     2884                if (ptr + 1 < patternEnd && ptr[1] == '+') {
    28942885                    ptr++;
    28952886                    length += 2 + 2*LINK_SIZE;
     
    29092900                /* In UTF-8 mode, check for additional bytes. */
    29102901               
    2911                 if (c > 127)
    2912                 {
    2913                     if (IS_LEADING_SURROGATE(c))
    2914                     {
    2915                         c = DECODE_SURROGATE_PAIR(c, ptr < patternEnd ? *ptr : 0);
     2902                if (c > 127) {
     2903                    if (isLeadingSurrogate(c)) {
     2904                        c = decodeSurrogatePair(c, ptr < patternEnd ? *ptr : 0);
    29162905                        ++ptr;
    29172906                    }
     
    31393128    if (numSubpatterns)
    31403129        *numSubpatterns = re->top_bracket;
    3141     return static_cast<JSRegExp*>(re);
     3130    return re;
    31423131}
    31433132
Note: See TracChangeset for help on using the changeset viewer.