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

Diff of /code/trunk/pcregrep.c

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

revision 1033 by ph10, Mon Sep 10 11:02:48 2012 UTC revision 1035 by ph10, Mon Sep 10 16:23:12 2012 UTC
# Line 2880  for (fn = pattern_files; fn != NULL; fn Line 2880  for (fn = pattern_files; fn != NULL; fn
2880      goto EXIT2;      goto EXIT2;
2881    }    }
2882    
2883  /* Study the regular expressions, as we will be running them many times. Unless  /* Study the regular expressions, as we will be running them many times. If an
2884  JIT has been explicitly disabled, arrange a stack for it to use. */  extra block is needed for a limit, set PCRE_STUDY_EXTRA_NEEDED so that one is
2885    returned, even if studying produces no data. */
2886    
2887    if (match_limit > 0 || match_limit_recursion > 0)
2888      study_options |= PCRE_STUDY_EXTRA_NEEDED;
2889    
2890    /* Unless JIT has been explicitly disabled, arrange a stack for it to use. */
2891    
2892  #ifdef SUPPORT_PCREGREP_JIT  #ifdef SUPPORT_PCREGREP_JIT
2893  if ((study_options & PCRE_STUDY_JIT_COMPILE) != 0)  if ((study_options & PCRE_STUDY_JIT_COMPILE) != 0)
# Line 2905  for (j = 1, cp = patterns; cp != NULL; j Line 2911  for (j = 1, cp = patterns; cp != NULL; j
2911    }    }
2912    
2913  /* If --match-limit or --recursion-limit was set, put the value(s) into the  /* If --match-limit or --recursion-limit was set, put the value(s) into the
2914  pcre_extra block for each pattern. */  pcre_extra block for each pattern. There will always be an extra block because
2915    of the use of PCRE_STUDY_EXTRA_NEEDED above. */
2916    
2917  if (match_limit > 0 || match_limit_recursion > 0)  for (cp = patterns; cp != NULL; cp = cp->next)
2918    {    {
2919    for (cp = patterns; cp != NULL; cp = cp->next)    if (match_limit > 0)
2920        {
2921        cp->hint->flags |= PCRE_EXTRA_MATCH_LIMIT;
2922        cp->hint->match_limit = match_limit;
2923        }
2924    
2925      if (match_limit_recursion > 0)
2926      {      {
2927      if (cp->hint == NULL)      cp->hint->flags |= PCRE_EXTRA_MATCH_LIMIT_RECURSION;
2928        {      cp->hint->match_limit_recursion = match_limit_recursion;
       cp->hint = (pcre_extra *)malloc(sizeof(pcre_extra));  
       if (cp->hint == NULL)  
         {  
         fprintf(stderr, "pcregrep: malloc failed\n");  
         pcregrep_exit(2);  
         }  
       }  
     if (match_limit > 0)  
       {  
       cp->hint->flags |= PCRE_EXTRA_MATCH_LIMIT;  
       cp->hint->match_limit = match_limit;  
       }  
     if (match_limit_recursion > 0)  
       {  
       cp->hint->flags |= PCRE_EXTRA_MATCH_LIMIT_RECURSION;  
       cp->hint->match_limit_recursion = match_limit_recursion;  
       }  
2929      }      }
2930    }    }
2931    

Legend:
Removed from v.1033  
changed lines
  Added in v.1035

  ViewVC Help
Powered by ViewVC 1.1.5