+2017-01-26 Jason Hood <jadoxa@yahoo.com.au>
+
+ Honour GLOB_CASEMATCH for globbing sets; cf. issue [#2327].
+
+ * include/glob.h (GLOB_CASEMATCH): Update comment.
+ * mingwex/glob.c (glob_case_match): Move before, and use it in...
+ (glob_in_set): ...this function, to test characters in the set.
+
2017-01-26 Keith Marshall <keithmarshall@users.sourceforge.net>
Avoid snprintf() overhead in directory stream functions.
* $Id$
*
* Written by Keith Marshall <keithmarshall@users.sourceforge.net>
- * Copyright (C) 2011, 2012, 2014, 2016, MinGW.org Project.
+ * Copyright (C) 2011, 2012, 2014, 2016, 2017, MinGW.org Project.
*
*
* Permission is hereby granted, free of charge, to any person obtaining a
* but to better support the MS-Windows
* file system, the MinGW implementation
* of glob() performs a CASE INSENSITIVE
- * character match by default, (except
- * when matching within character group
- * patterns, which are ALWAYS assumed to
- * require CASE SENSITIVE matching).
+ * character match by default.
*/
__GLOB_CASEMATCH_OFFSET,
/*
* $Id$
*
* Written by Keith Marshall <keithmarshall@users.sourceforge.net>
- * Copyright (C) 2011-2014, MinGW.org Project.
+ * Copyright (C) 2011-2014, 2017, MinGW.org Project.
*
*
* Permission is hereby granted, free of charge, to any person obtaining a
return ++p;
}
+GLOB_INLINE int glob_case_match( int flags, int check, int match )
+{
+ /* Local helper function, used to facilitate the case insensitive
+ * glob character matching appropriate for MS-Windows systems.
+ */
+ return (flags & GLOB_CASEMATCH) ? check - match
+ : tolower( check ) - tolower( match );
+}
+
static const char *glob_in_set( const char *set, int test, int flags )
{
/* Check if the single character "test" is present in the set
/* ...in incremental collating sequence order, to the next
* character following the '-'...
*/
- if( lastc++ == test )
+ if( glob_case_match( flags, lastc++, test ) == 0 )
/*
* ...returning immediately on a successful match...
*/
* range may have been specified in decrementing collating
* sequence order...
*/
- if( lastc-- == test )
+ if( glob_case_match( flags, lastc--, test ) == 0 )
/*
* ...once again, return immediately on a successful match.
*/
*/
return NULL;
- if( c == test )
+ if( glob_case_match( flags, c, test ) == 0 )
/*
* We found the test character within the set; adjust the pattern
* reference, to resume after the end of the set, and return the
return NULL;
}
-GLOB_INLINE int glob_case_match( int flags, int check, int match )
-{
- /* Local helper function, used to facilitate the case insensitive
- * glob character matching appropriate for MS-Windows systems.
- */
- return (flags & GLOB_CASEMATCH) ? check - match
- : tolower( check ) - tolower( match );
-}
-
static int glob_strcmp( const char *pattern, const char *text, int flags )
{
/* Compare "text" to a specified globbing "pattern" using semantics