apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wr...@apache.org
Subject svn commit: r1102995 - /apr/apr/trunk/strings/apr_fnmatch.c
Date Sat, 14 May 2011 09:58:19 GMT
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.
              */



Mime
View raw message