|
From: Keith M. <no...@so...> - 2017-01-26 20:41:04
|
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Repository: mingw-org-wsl".
The branch, 5.0-active has been updated
via cc2f1a7a56d95bfb20b97f022f0a1dc7f8250387 (commit)
via df96caa682ec8abb3faf6caa181205b2de028fb5 (commit)
via 597dadeab7bb2070d5bd5a5c06e4b4b98493b1aa (commit)
from 490e36035f4e6d99a01faaee73c297b7f385f3a3 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
https://sf.net/p/mingw/mingw-org-wsl/ci/cc2f1a7a56d95bfb20b97f022f0a1dc7f8250387/
commit cc2f1a7a56d95bfb20b97f022f0a1dc7f8250387
Author: Jason Hood <ja...@ya...>
Date: Thu Jan 26 20:34:13 2017 +0000
Honour GLOB_CASEMATCH for globbing sets; cf. issue [#2327].
diff --git a/mingwrt/ChangeLog b/mingwrt/ChangeLog
index 67091e8..41a6e08 100644
--- a/mingwrt/ChangeLog
+++ b/mingwrt/ChangeLog
@@ -1,3 +1,11 @@
+2017-01-26 Jason Hood <ja...@ya...>
+
+ 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 <kei...@us...>
Avoid snprintf() overhead in directory stream functions.
diff --git a/mingwrt/include/glob.h b/mingwrt/include/glob.h
index 9cfa169..45e1c9a 100644
--- a/mingwrt/include/glob.h
+++ b/mingwrt/include/glob.h
@@ -8,7 +8,7 @@
* $Id$
*
* Written by Keith Marshall <kei...@us...>
- * 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
@@ -94,10 +94,7 @@ enum {
* 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,
/*
diff --git a/mingwrt/mingwex/glob.c b/mingwrt/mingwex/glob.c
index 8b5332a..1f064e1 100644
--- a/mingwrt/mingwex/glob.c
+++ b/mingwrt/mingwex/glob.c
@@ -7,7 +7,7 @@
* $Id$
*
* Written by Keith Marshall <kei...@us...>
- * 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
@@ -227,6 +227,15 @@ static const char *glob_set_adjusted( const char *pattern, int flags )
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
@@ -283,7 +292,7 @@ static const char *glob_in_set( const char *set, int test, int flags )
/* ...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...
*/
@@ -295,7 +304,7 @@ static const char *glob_in_set( const char *set, int test, int flags )
* 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.
*/
@@ -316,7 +325,7 @@ static const char *glob_in_set( const char *set, int test, int flags )
*/
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
@@ -337,15 +346,6 @@ static const char *glob_in_set( const char *set, int test, int flags )
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
https://sf.net/p/mingw/mingw-org-wsl/ci/df96caa682ec8abb3faf6caa181205b2de028fb5/
commit df96caa682ec8abb3faf6caa181205b2de028fb5
Author: Keith Marshall <kei...@us...>
Date: Thu Jan 26 18:56:27 2017 +0000
Avoid snprintf() overhead in directory stream functions.
diff --git a/mingwrt/ChangeLog b/mingwrt/ChangeLog
index b90c04e..67091e8 100644
--- a/mingwrt/ChangeLog
+++ b/mingwrt/ChangeLog
@@ -1,5 +1,16 @@
2017-01-26 Keith Marshall <kei...@us...>
+ Avoid snprintf() overhead in directory stream functions.
+
+ * mingwex/dirent.c (dirent_update): Do not use either snprintf() or
+ snwprintf() functions when updating dd->d_name and dd->d_namlen data;
+ emulate them instead, using a lightweight inline char-by-char counted
+ copy loop, operating on char or wchar_t data as appropriate.
+ (DIRENT_ASSIGN_NAME): Macro no longer required; delete it.
+ (NUL): New manifest constant; define it.
+
+2017-01-26 Keith Marshall <kei...@us...>
+
Avoid #include_next misbehaviour; cf. MinGW-Bug [#2330]
* include/ctype.h (wctype.h): Use "..." form of #include, rather than
diff --git a/mingwrt/mingwex/dirent.c b/mingwrt/mingwex/dirent.c
index e6813c1..10a2ac7 100644
--- a/mingwrt/mingwex/dirent.c
+++ b/mingwrt/mingwex/dirent.c
@@ -1,24 +1,46 @@
/*
* dirent.c
*
- * This file has no copyright assigned and is placed in the Public Domain.
+ * $Id$
+ *
+ * Provides emulation of POSIX "directory stream" manipulation functions,
+ * in terms of the MS-Windows FindFile API.
*
- * This file is a part of the mingw-runtime package.
- * No warranty is given; refer to the file DISCLAIMER within the package.
*
* Derived from DIRLIB.C by Matt J. Weinstein
- * This note appears in the DIRLIB.H
+ * This note appears in the associated DIRLIB.H header file:
* DIRLIB.H by M. J. Weinstein Released to public domain 1-Jan-89
*
* Updated by Jeremy Bettis <je...@hk...>
* Significantly revised and rewinddir, seekdir and telldir added
* by Colin Peters <co...@fu...>
+ *
* Further significantly revised for improved memory utilisation,
* efficiency in operation, and better POSIX standards compliance
* by Keith Marshall <kei...@us...>
+ * Copyright (C) 1997, 2001-2006, 2014, 2017, MinGW.org Project
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice, this permission notice, and the following
+ * disclaimer shall be included in all copies or substantial portions of
+ * the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OF OR OTHER
+ * DEALINGS IN THE SOFTWARE.
*
*/
-#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
@@ -28,23 +50,6 @@
#include <windows.h>
#include <tchar.h>
-#ifdef _UNICODE
- /* In a Unicode build, the path name within the _wdirent struct is
- * represented by a wchar_t string; we use the snwprintf() function
- * to simultaneously assign the d_name and d_namlen fields, copying
- * from a temporary WIN32_FIND_DATA struct on the stack...
- */
-# include <wchar.h>
-# define DIRENT_ASSIGN_NAME snwprintf
-
-#else
- /* ...while for a non-Unicode build, the corresponding data within
- * the dirent structure is represented by a normal char string, and
- * the assignments are made by the snprintf() function.
- */
-# define DIRENT_ASSIGN_NAME snprintf
-#endif
-
/* This implementation applies a "__mingw_" pseudo-namespace prefix to
* the standard POSIX function names, for each each function it defines;
* the following pair of macros facilitates this.
@@ -150,16 +155,33 @@ struct __wdirstream_t
*/
#define DT_VALID_BITS ~(DT_IGNORED | 0x0080)
+/* For convenience, we identify the NUL "character" which terminates any
+ * file or directory name, appropriately typed, using this macro:
+ */
+#define NUL ((_TCHAR)(0))
+
static
void dirent_update( struct _tdirent *dd, WIN32_FIND_DATA *fd )
{
/* Helper function, used by dirent_findfirst() and dirent_findnext(),
* to transfer all relevant data from their respective WIN32_FIND_DATA
- * buffers to the specified dirent structure.
+ * buffers to the specified dirent structure; in the case of the d_name
+ * field, we want the effect of a snprintf() string transfer, but to
+ * avoid the (perceptually significant) overhead of format parsing,
+ * we simulate it with an inline character-by-character counted
+ * string copy loop...
+ */
+ _TCHAR *d_name = dd->d_name;
+ for( dd->d_namlen = 0; (*d_name = fd->cFileName[dd->d_namlen]) != NUL; )
+ /*
+ * ...continuing to count input characters, until the terminal NUL,
+ * but declining to store any character beyond the physical end of
+ * the d_name field buffer.
+ */
+ if( ++dd->d_namlen < FILENAME_MAX ) ++d_name;
+
+ /* Store only those file attribute bits which are valid for d_type.
*/
- dd->d_namlen = DIRENT_ASSIGN_NAME( dd->d_name, FILENAME_MAX,
- _T("%s"), fd->cFileName
- );
if( (dd->d_type = fd->dwFileAttributes & DT_VALID_BITS) > DT_DIR )
dd->d_type = DT_UNKNOWN;
}
https://sf.net/p/mingw/mingw-org-wsl/ci/597dadeab7bb2070d5bd5a5c06e4b4b98493b1aa/
commit 597dadeab7bb2070d5bd5a5c06e4b4b98493b1aa
Author: Keith Marshall <kei...@us...>
Date: Thu Jan 26 16:14:43 2017 +0000
Avoid #include_next misbehaviour; cf. MinGW-Bug [#2330]
diff --git a/mingwrt/ChangeLog b/mingwrt/ChangeLog
index aed25b8..b90c04e 100644
--- a/mingwrt/ChangeLog
+++ b/mingwrt/ChangeLog
@@ -1,3 +1,14 @@
+2017-01-26 Keith Marshall <kei...@us...>
+
+ Avoid #include_next misbehaviour; cf. MinGW-Bug [#2330]
+
+ * include/ctype.h (wctype.h): Use "..." form of #include, rather than
+ the <...> form; we must include our own corresponding mingwrt version
+ of this subsidiary header, and avoid any bogus alternative which may
+ have been insinuated earlier in the system header path.
+
+ * include/string.h (wchar.h): Likewise.
+
2017-01-25 Jason Hood <ja...@ya...>
Correct quoted backslash handling, per bug [#2328].
diff --git a/mingwrt/include/ctype.h b/mingwrt/include/ctype.h
index 5c4ef43..7ff41a0 100644
--- a/mingwrt/include/ctype.h
+++ b/mingwrt/include/ctype.h
@@ -6,7 +6,7 @@
* $Id$
*
* Written by Colin Peters <co...@bi...>
- * Copyright (C) 1997-2008, 2016, MinGW.org Project
+ * Copyright (C) 1997-2008, 2016, 2017, MinGW.org Project
*
*
* Permission is hereby granted, free of charge, to any person obtaining a
@@ -42,17 +42,21 @@
* properly declared here, this file should also declare elements of the
* wide classification API, which is properly declared in <wctype.h>
*
- * To avoid the burden of maintaining duplicate declarations, in two
+ * To avoid the burden of maintaining duplicate declarations in two
* locations, we keep the wide character declarations where ISO-C and
* POSIX say they belong, in <wctype.h>, while accommodating Microsoft
* compatibility by providing for selective inclusion of the relevant
* elements of it here. (Note that we must do this early, because to
* avoid duplication, we delegate the definition of common character
* classification macros, with the exception of _LEADBYTE, which is
- * not required in both headers, to <wctype.h>).
+ * not required in both headers, to <wctype.h>; we use the quoted
+ * form of inclusion here, to ensure that we get our own "wctype.h",
+ * and not any predecessor which may have been insinuated into the
+ * system include path, and which may interfere with our mechanism
+ * for partial inclusion of shared header content).
*/
#define __CTYPE_H_SOURCED__
-#include <wctype.h>
+#include "wctype.h"
/* This is the one character classification macro, for which definition
* is NOT delegated to <wctype.h>
diff --git a/mingwrt/include/string.h b/mingwrt/include/string.h
index 720c85a..6cc4f88 100644
--- a/mingwrt/include/string.h
+++ b/mingwrt/include/string.h
@@ -6,7 +6,7 @@
* $Id$
*
* Written by Colin Peters <co...@bi...>
- * Copyright (C) 1997-2000, 2002-2004, 2007, 2009, 2015, 2016,
+ * Copyright (C) 1997-2000, 2002-2004, 2007, 2009, 2015-2017,
* MinGW.org Project.
*
*
@@ -160,9 +160,13 @@ _CRTIMP __cdecl __MINGW_NOTHROW void swab (const char *, char *, size_t);
* scope, will selectively expose the required function prototypes;
* however, strictly ISO-C conforming applications should include
* <wchar.h> directly; they should not rely on this MSVC specific
- * anomalous behaviour.
+ * anomalous behaviour. (We use the quoted form of inclusion here,
+ * to ensure that we get our own "wchar.h", and not any predecessor
+ * which may have been insinuated into the system include path, and
+ * so could interfere with our mechanism for partial inclusion of
+ * shared header content).
*/
-#include <wchar.h>
+#include "wchar.h"
#endif /* ! __STRICT_ANSI__ */
-----------------------------------------------------------------------
Summary of changes:
mingwrt/ChangeLog | 30 ++++++++++++++++++
mingwrt/include/ctype.h | 12 +++++--
mingwrt/include/glob.h | 7 +---
mingwrt/include/string.h | 10 ++++--
mingwrt/mingwex/dirent.c | 74 +++++++++++++++++++++++++++++----------------
mingwrt/mingwex/glob.c | 26 ++++++++--------
6 files changed, 108 insertions(+), 51 deletions(-)
hooks/post-receive
--
Repository: mingw-org-wsl
|