You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by wr...@apache.org on 2011/05/14 11:58:19 UTC
svn commit: r1102995 - /apr/apr/trunk/strings/apr_fnmatch.c
Author: wrowe
Date: Sat May 14 09:58:19 2011
New Revision: 1102995
URL: http://svn.apache.org/viewvc?rev=1102995&view=rev
Log:
Optimize []...] pattern case
Modified:
apr/apr/trunk/strings/apr_fnmatch.c
Modified: apr/apr/trunk/strings/apr_fnmatch.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/strings/apr_fnmatch.c?rev=1102995&r1=1102994&r2=1102995&view=diff
==============================================================================
--- apr/apr/trunk/strings/apr_fnmatch.c (original)
+++ apr/apr/trunk/strings/apr_fnmatch.c Sat May 14 09:58:19 2011
@@ -90,10 +90,13 @@ static APR_INLINE int fnmatch_ch(const c
if (negate)
++*pattern;
+ /* ']' is an ordinary character at the start of the range pattern */
+ if (**pattern == ']')
+ goto leadingclosebrace;
+
while (**pattern)
{
- /* ']' is an ordinary character at the start of the range pattern */
- if ((**pattern == ']') && (*pattern > mismatch + 1)) {
+ if (**pattern == ']') {
++*pattern;
/* XXX: Fix for MBCS character width */
++*string;
@@ -112,6 +115,7 @@ static APR_INLINE int fnmatch_ch(const c
if (slash && (**pattern == '/'))
break;
+leadingclosebrace:
/* Look at only well-formed range patterns; ']' is allowed only if escaped,
* while '/' is not allowed at all in FNM_PATHNAME mode.
*/