com php-src: Switch to FindFirstFileEx with basic info level: Zend/zend_virtual_cwd.c win32/readdir.c

[email protected] (Anatol Belski)
Newsgroups php.cvs
Message-ID <[email protected]>
Commit:    ad4ef13c5debaf078bc431a9e5fa54770771095b
Author:    Anatol Belski <[email protected]>         Fri, 7 Apr 2017 21:12:52 +0200
Parents:   be71f9ed69091f56df2c39b43ceaf23e04bda7de
Branches:  master

Link:       http://git.php.net/?p=php-src.git;a=commitdiff;h=ad4ef13c5debaf078bc431a9e5fa54770771095b

Log:
Switch to FindFirstFileEx with basic info level

That omits querying of short names, thus improving perf.

Changed paths:
  M  Zend/zend_virtual_cwd.c
  M  win32/readdir.c


Diff:
diff --git a/Zend/zend_virtual_cwd.c b/Zend/zend_virtual_cwd.c
index f834fa3..fd19892 100644
--- a/Zend/zend_virtual_cwd.c
+++ b/Zend/zend_virtual_cwd.c
@@ -812,7 +812,7 @@ static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, i
 			if (!pathw) {
 				return -1;
 			}
-			hFind = FindFirstFileW(pathw, &dataw);
+			hFind = FindFirstFileExW(pathw, FindExInfoBasic, &dataw, FindExSearchNameMatch, NULL, 0);
 			if (INVALID_HANDLE_VALUE == hFind) {
 				if (use_realpath == CWD_REALPATH) {
 					/* file not found */
diff --git a/win32/readdir.c b/win32/readdir.c
index 1031fe2..6cde75f 100644
--- a/win32/readdir.c
+++ b/win32/readdir.c
@@ -62,7 +62,7 @@ DIR *opendir(const char *dir)
 		filespecw[index] = L'\0';
 	wcscat(filespecw, L"\\*");
 
-	if ((handle = FindFirstFileW(filespecw, &(dp->fileinfo))) == INVALID_HANDLE_VALUE) {
+	if ((handle = FindFirstFileExW(filespecw, FindExInfoBasic, &(dp->fileinfo), FindExSearchNameMatch, NULL, 0)) == INVALID_HANDLE_VALUE) {
 		DWORD err = GetLastError();
 		if (err == ERROR_NO_MORE_FILES || err == ERROR_FILE_NOT_FOUND) {
 			dp->finished = 1;
@@ -201,7 +201,7 @@ int rewinddir(DIR *dp)
 		filespecw[index] = L'\0';
 	wcscat(filespecw, L"/*");
 
-	if ((handle = FindFirstFileW(filespecw, &(dp->fileinfo))) == INVALID_HANDLE_VALUE) {
+	if ((handle = FindFirstFileExW(filespecw, FindExInfoBasic, &(dp->fileinfo), FindExSearchNameMatch, NULL, 0)) == INVALID_HANDLE_VALUE) {
 		dp->finished = 1;
 	}
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.