# # # patch "globish.cc" # from [db87786cc191ad8c0f6b48264a6dc2eb158a982a] # to [e7da31307bd447174113a1c37d69395da088d05a] # ============================================================ --- globish.cc db87786cc191ad8c0f6b48264a6dc2eb158a982a +++ globish.cc e7da31307bd447174113a1c37d69395da088d05a @@ -358,10 +358,11 @@ static bool static bool -do_match(string::const_iterator s, string::const_iterator se, +do_match(string::const_iterator sb, string::const_iterator se, string::const_iterator p, string::const_iterator pe) { unsigned int sc, pc; + string::const_iterator s(sb); if (global_sanity.debug_p()) // decode() is expensive L(FL("subpattern: '%s' against '%s'") % string(s,se) % decode(p,pe)); @@ -369,8 +370,12 @@ do_match(string::const_iterator s, strin while (p < pe) { pc = widen(*p++); - sc = s < se ? widen(*s) : 0; - s++; + if(s < se) { + sc = widen(*s); + s++; + } else { + sc = 0; + } switch (pc) { default: // literal @@ -460,7 +465,9 @@ do_match(string::const_iterator s, strin prest = find_next_subpattern(p, pe, false); psub = p; - s--; + if(s > sb) { + s--; + } do { pnext = find_next_subpattern(psub, pe, true);