]> granicus.if.org Git - php/commitdiff
Switch to FindFirstFileEx with basic info level
authorAnatol Belski <ab@php.net>
Fri, 7 Apr 2017 19:12:52 +0000 (21:12 +0200)
committerAnatol Belski <ab@php.net>
Fri, 7 Apr 2017 19:15:37 +0000 (21:15 +0200)
That omits querying of short names, thus improving perf.

Zend/zend_virtual_cwd.c
win32/readdir.c

index f834fa3ad1193985efc3ba77b3abba25d2f705f1..fd19892c620f27de78eb23681ca924f3e68899f5 100644 (file)
@@ -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 */
index 1031fe2ac247bdc76c0eef2340939478d12cea86..6cde75ff2c798a2437b43d10524e6d416547c3d9 100644 (file)
@@ -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;
        }