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:01:56 UTC
svn commit: r1102996 - /apr/apr/branches/1.5.x/strings/apr_fnmatch.c
Author: wrowe
Date: Sat May 14 10:01:56 2011
New Revision: 1102996
URL: http://svn.apache.org/viewvc?rev=1102996&view=rev
Log:
Fix []...] pattern bug noted by jorton
Optimize []...] pattern case
Backport: r1102992, r1102995
Modified:
apr/apr/branches/1.5.x/strings/apr_fnmatch.c
Modified: apr/apr/branches/1.5.x/strings/apr_fnmatch.c
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.5.x/strings/apr_fnmatch.c?rev=1102996&r1=1102995&r2=1102996&view=diff
==============================================================================
--- apr/apr/branches/1.5.x/strings/apr_fnmatch.c (original)
+++ apr/apr/branches/1.5.x/strings/apr_fnmatch.c Sat May 14 10:01:56 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.
*/