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 12:02:26 UTC

svn commit: r1102997 - /apr/apr/branches/1.4.x/strings/apr_fnmatch.c

Author: wrowe
Date: Sat May 14 10:02:26 2011
New Revision: 1102997

URL: http://svn.apache.org/viewvc?rev=1102997&view=rev
Log:
Fix []...] pattern bug noted by jorton
Optimize []...] pattern case

Backport: r1102992, r1102995

Modified:
    apr/apr/branches/1.4.x/strings/apr_fnmatch.c

Modified: apr/apr/branches/1.4.x/strings/apr_fnmatch.c
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.4.x/strings/apr_fnmatch.c?rev=1102997&r1=1102996&r2=1102997&view=diff
==============================================================================
--- apr/apr/branches/1.4.x/strings/apr_fnmatch.c (original)
+++ apr/apr/branches/1.4.x/strings/apr_fnmatch.c Sat May 14 10:02:26 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)) {
+            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.
              */