[pcre-dev] Calculate minimum subject length

Top Page
Delete this message
Author: ND
Date:  
To: Pcre-dev
Subject: [pcre-dev] Calculate minimum subject length
Good day!


There is a function find_minlength()in pcre2_study.c that calculates min
subject length.


1. It drops patterns that have (*ACCEPT) verb.


     /* ACCEPT makes things far too complicated; we have to give up. In  
fact,
     from 10.34 onwards, if a pattern contains (*ACCEPT), this function is  
not
     used. However, leave the code in place, just in case. */


     case OP_ACCEPT:
     case OP_ASSERT_ACCEPT:
     return -1;




May be when meet (*ACCEPT) find_minlength must simply drop further
calculations for current branch. So the current value of "branchlength"
will be immediately considered as a minimum length of whole branch.


2. If current branch is ended and calculated branchlength=0 then it seems
no need to calculate the rest branches. May be this behaviour is present
in code but I don't find it. If no, may be it can be useful.


Thanks.