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

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

Reviewed by Sam.

Get rid of PCRE custom char types

  • pcre/pcre_compile.cpp: (check_escape): (complete_callout): (compile_branch): (compile_regex): (calculateCompiledPatternLengthAndFlags): (jsRegExpCompile):
  • pcre/pcre_exec.cpp: (match_ref): (match): (jsRegExpExecute):
  • pcre/pcre_internal.h:
File:
1 edited

Legend:

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

    r28139 r28141  
    6666are on the heap, not on the stack. */
    6767
    68 typedef struct eptrblock {
    69   struct eptrblock *epb_prev;
    70   USPTR epb_saved_eptr;
    71 } eptrblock;
     68struct eptrblock {
     69  struct eptrblock* epb_prev;
     70  UChar* epb_saved_eptr;
     71};
    7272
    7373/* Structure for remembering the local variables in a private frame */
     
    8888  /* Function arguments that may change */
    8989
    90   const pcre_uchar* eptr;
     90  UChar* eptr;
    9191  const uschar* ecode;
    9292  int offset_top;
     
    9797  const uschar* data;
    9898  const uschar* next;
    99   const pcre_uchar* pp;
     99  const UChar* pp;
    100100  const uschar* prev;
    101   const pcre_uchar* saved_eptr;
     101  const UChar* saved_eptr;
    102102
    103103  int repeat_othercase;
     
    126126  const uschar *ctypes;         /* Points to table of type maps */
    127127  BOOL   offset_overflow;       /* Set if too many extractions */
    128   USPTR  start_subject;         /* Start of the subject string */
    129   USPTR  end_subject;           /* End of the subject string */
    130   USPTR  end_match_ptr;         /* Subject position at end match */
     128  UChar*  start_subject;         /* Start of the subject string */
     129  UChar*  end_subject;           /* End of the subject string */
     130  UChar*  end_match_ptr;         /* Subject position at end match */
    131131  int    end_offset_top;        /* Highwater mark at end of match */
    132132  BOOL   multiline;
     
    167167
    168168static void
    169 pchars(const pcre_uchar *p, int length, BOOL is_subject, match_data *md)
     169pchars(const UChar* p, int length, BOOL is_subject, match_data *md)
    170170{
    171171int c;
     
    197197
    198198static BOOL
    199 match_ref(int offset, USPTR eptr, int length, match_data *md)
     199match_ref(int offset, UChar* eptr, int length, match_data *md)
    200200{
    201 USPTR p = md->start_subject + md->offset_vector[offset];
     201UChar* p = md->start_subject + md->offset_vector[offset];
    202202
    203203#ifdef DEBUG
     
    224224  while (length-- > 0)
    225225    {
    226     pcre_uchar c = *p++;
     226    UChar c = *p++;
    227227    int othercase = _pcre_ucp_othercase(c);
    228     pcre_uchar d = *eptr++;
     228    UChar d = *eptr++;
    229229    if (c != d && othercase != d) return false;
    230230    }
     
    404404}
    405405
    406 static int match(USPTR eptr, const uschar* ecode, int offset_top, match_data* md)
     406static int match(UChar* eptr, const uschar* ecode, int offset_top, match_data* md)
    407407{
    408408    int is_match = false;
     
    776776                    prev_is_word = false;
    777777                else {
    778                     const pcre_uchar *lastptr = stack.currentFrame->eptr - 1;
     778                    const UChar* lastptr = stack.currentFrame->eptr - 1;
    779779                    while(isTrailingSurrogate(*lastptr))
    780780                        lastptr--;
     
    20692069   
    20702070    match_data match_block;
    2071     match_block.start_subject = (USPTR)subject;
     2071    match_block.start_subject = (UChar*)subject;
    20722072    match_block.end_subject = match_block.start_subject + length;
    2073     USPTR end_subject = match_block.end_subject;
     2073    UChar* end_subject = match_block.end_subject;
    20742074   
    20752075    match_block.lcc = _pcre_default_tables + lcc_offset;
     
    21482148     the loop runs just once. */
    21492149   
    2150     USPTR start_match = (USPTR)subject + start_offset;
    2151     USPTR req_byte_ptr = start_match - 1;
     2150    UChar* start_match = (UChar*)subject + start_offset;
     2151    UChar* req_byte_ptr = start_match - 1;
    21522152    bool startline = re->options & PCRE_STARTLINE;
    21532153   
    21542154    do {
    2155         USPTR save_end_subject = end_subject;
     2155        UChar* save_end_subject = end_subject;
    21562156       
    21572157        /* Reset the maximum number of extractions we might see. */
     
    21732173       
    21742174        if (first_byte >= 0) {
    2175             pcre_uchar first_char = first_byte;
     2175            UChar first_char = first_byte;
    21762176            if (first_byte_caseless)
    21772177                while (start_match < end_subject) {
     
    22242224       
    22252225        if (req_byte >= 0 && end_subject - start_match < REQ_BYTE_MAX) {
    2226             USPTR p = start_match + ((first_byte >= 0)? 1 : 0);
     2226            UChar* p = start_match + ((first_byte >= 0)? 1 : 0);
    22272227           
    22282228            /* We don't need to repeat the search if we haven't yet reached the
Note: See TracChangeset for help on using the changeset viewer.