On 5/12/2011 3:40 AM, Joe Orton wrote:
>
> File 'strings/apr_fnmatch.c'
> Lines executed:91.48% of 176
> Branches executed:95.40% of 261
> Taken at least once:81.61% of 261
> Calls executed:100.00% of 17
Can you email me the coverage detail report? It should identify further
optimizations.
> I had one question actually, if you have a spare moment ever, there was
> a branch I could not work out how to trigger in fnmatch_ch():
>
> if (**pattern == '[')
> {
> ++*pattern;
> ...
> while (**pattern)
> {
> /* ']' is an ordinary character at the start of the range pattern
> */
> if ((**pattern == ']') && (*pattern > mismatch)) {
>
> That last expression (*pattern > mismatch) looks like it should always
> evaluate to true; I could not work out why that test should be necessary.
I believe what is meant is mismatch + 1; []] should be valid to find ']', only
as the leading character, and a quick test confirms it fails. But the exception
is more optimal if handled ahead of while (**pattern)... fixing shortly.