/[pcre]/code/trunk/pcre_compile.c
ViewVC logotype

Diff of /code/trunk/pcre_compile.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 438 by ph10, Sun Sep 6 20:00:47 2009 UTC revision 447 by ph10, Tue Sep 15 18:17:54 2009 UTC
# Line 4440  we set the flag only if there is a liter Line 4440  we set the flag only if there is a liter
4440          if (namelen == verbs[i].len &&          if (namelen == verbs[i].len &&
4441              strncmp((char *)name, vn, namelen) == 0)              strncmp((char *)name, vn, namelen) == 0)
4442            {            {
4443            *code = verbs[i].op;            /* Check for open captures before ACCEPT */
4444            if (*code++ == OP_ACCEPT) cd->had_accept = TRUE;  
4445              if (verbs[i].op == OP_ACCEPT)
4446                {
4447                open_capitem *oc;
4448                cd->had_accept = TRUE;
4449                for (oc = cd->open_caps; oc != NULL; oc = oc->next)
4450                  {
4451                  *code++ = OP_CLOSE;
4452                  PUT2INC(code, 0, oc->number);
4453                  }
4454                }
4455              *code++ = verbs[i].op;
4456            break;            break;
4457            }            }
4458          vn += verbs[i].len + 1;          vn += verbs[i].len + 1;
# Line 5669  uschar *code = *codeptr; Line 5680  uschar *code = *codeptr;
5680  uschar *last_branch = code;  uschar *last_branch = code;
5681  uschar *start_bracket = code;  uschar *start_bracket = code;
5682  uschar *reverse_count = NULL;  uschar *reverse_count = NULL;
5683    open_capitem capitem;
5684    int capnumber = 0;
5685  int firstbyte, reqbyte;  int firstbyte, reqbyte;
5686  int branchfirstbyte, branchreqbyte;  int branchfirstbyte, branchreqbyte;
5687  int length;  int length;
# Line 5695  the code that abstracts option settings Line 5708  the code that abstracts option settings
5708  them global. It tests the value of length for (2 + 2*LINK_SIZE) in the  them global. It tests the value of length for (2 + 2*LINK_SIZE) in the
5709  pre-compile phase to find out whether anything has yet been compiled or not. */  pre-compile phase to find out whether anything has yet been compiled or not. */
5710    
5711    /* If this is a capturing subpattern, add to the chain of open capturing items
5712    so that we can detect them if (*ACCEPT) is encountered. */
5713    
5714    if (*code == OP_CBRA)
5715      {
5716      capnumber = GET2(code, 1 + LINK_SIZE);
5717      capitem.number = capnumber;
5718      capitem.next = cd->open_caps;
5719      cd->open_caps = &capitem;
5720      }
5721    
5722  /* Offset is set zero to mark that this bracket is still open */  /* Offset is set zero to mark that this bracket is still open */
5723    
5724  PUT(code, 1, 0);  PUT(code, 1, 0);
# Line 5830  for (;;) Line 5854  for (;;)
5854          }          }
5855        while (branch_length > 0);        while (branch_length > 0);
5856        }        }
5857    
5858        /* If it was a capturing subpattern, remove it from the chain. */
5859    
5860        if (capnumber > 0) cd->open_caps = cd->open_caps->next;
5861    
5862      /* Fill in the ket */      /* Fill in the ket */
5863    
# Line 6398  cd->end_pattern = (const uschar *)(patte Line 6426  cd->end_pattern = (const uschar *)(patte
6426  cd->req_varyopt = 0;  cd->req_varyopt = 0;
6427  cd->external_options = options;  cd->external_options = options;
6428  cd->external_flags = 0;  cd->external_flags = 0;
6429    cd->open_caps = NULL;
6430    
6431  /* Now do the pre-compile. On error, errorcode will be set non-zero, so we  /* Now do the pre-compile. On error, errorcode will be set non-zero, so we
6432  don't need to look at the result of the function here. The initial options have  don't need to look at the result of the function here. The initial options have
# Line 6472  cd->start_code = codestart; Line 6501  cd->start_code = codestart;
6501  cd->hwm = cworkspace;  cd->hwm = cworkspace;
6502  cd->req_varyopt = 0;  cd->req_varyopt = 0;
6503  cd->had_accept = FALSE;  cd->had_accept = FALSE;
6504    cd->open_caps = NULL;
6505    
6506  /* Set up a starting, non-extracting bracket, then compile the expression. On  /* Set up a starting, non-extracting bracket, then compile the expression. On
6507  error, errorcode will be set non-zero, so we don't need to look at the result  error, errorcode will be set non-zero, so we don't need to look at the result

Legend:
Removed from v.438  
changed lines
  Added in v.447

webmaster@exim.org
ViewVC Help
Powered by ViewVC 1.1.12