You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by iv...@apache.org on 2022/01/05 17:45:33 UTC

svn commit: r1896724 - /apr/apr/trunk/file_io/win32/filestat.c

Author: ivan
Date: Wed Jan  5 17:45:33 2022
New Revision: 1896724

URL: http://svn.apache.org/viewvc?rev=1896724&view=rev
Log:
Win32: Minor optimization of apr_stat() and apr_file_info_get().

* file_io/win32/filestat.c
  (reparse_point_is_link, apr_stat): Use FindFirstFileExW(FindExInfoBasic)
   instead of FindFirstFileW().

Modified:
    apr/apr/trunk/file_io/win32/filestat.c

Modified: apr/apr/trunk/file_io/win32/filestat.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/file_io/win32/filestat.c?rev=1896724&r1=1896723&r2=1896724&view=diff
==============================================================================
--- apr/apr/trunk/file_io/win32/filestat.c (original)
+++ apr/apr/trunk/file_io/win32/filestat.c Wed Jan  5 17:45:33 2022
@@ -240,7 +240,8 @@ static int reparse_point_is_link(WIN32_F
             return 0;
         }
 
-        hFind = FindFirstFileW(wfname, &fd);
+        hFind = FindFirstFileExW(wfname, FindExInfoBasic, &fd, FindExSearchNameMatch,
+                                 NULL, 0);
         if (hFind == INVALID_HANDLE_VALUE) {
             return 0;
         }
@@ -653,7 +654,8 @@ APR_DECLARE(apr_status_t) apr_stat(apr_f
         if ((rv = test_safe_name(fname)) != APR_SUCCESS) {
             return rv;
         }
-        hFind = FindFirstFileW(wfname, &FileInfo.w);
+        hFind = FindFirstFileExW(wfname, FindExInfoBasic, &FileInfo.w,
+                                 FindExSearchNameMatch, NULL, 0);
         if (hFind == INVALID_HANDLE_VALUE)
             return apr_get_os_error();
         FindClose(hFind);



Re: svn commit: r1896724 - /apr/apr/trunk/file_io/win32/filestat.c

Posted by William A Rowe Jr <wr...@rowe-clan.net>.
Reviewing, and writing tests. Thanks for your analysis!

On Wed, Jan 5, 2022 at 11:45 AM <iv...@apache.org> wrote:
>
> Author: ivan
> Date: Wed Jan  5 17:45:33 2022
> New Revision: 1896724
>
> URL: http://svn.apache.org/viewvc?rev=1896724&view=rev
> Log:
> Win32: Minor optimization of apr_stat() and apr_file_info_get().
>
> * file_io/win32/filestat.c
>   (reparse_point_is_link, apr_stat): Use FindFirstFileExW(FindExInfoBasic)
>    instead of FindFirstFileW().
>
> Modified:
>     apr/apr/trunk/file_io/win32/filestat.c
>
> Modified: apr/apr/trunk/file_io/win32/filestat.c
> URL: http://svn.apache.org/viewvc/apr/apr/trunk/file_io/win32/filestat.c?rev=1896724&r1=1896723&r2=1896724&view=diff
> ==============================================================================
> --- apr/apr/trunk/file_io/win32/filestat.c (original)
> +++ apr/apr/trunk/file_io/win32/filestat.c Wed Jan  5 17:45:33 2022
> @@ -240,7 +240,8 @@ static int reparse_point_is_link(WIN32_F
>              return 0;
>          }
>
> -        hFind = FindFirstFileW(wfname, &fd);
> +        hFind = FindFirstFileExW(wfname, FindExInfoBasic, &fd, FindExSearchNameMatch,
> +                                 NULL, 0);
>          if (hFind == INVALID_HANDLE_VALUE) {
>              return 0;
>          }
> @@ -653,7 +654,8 @@ APR_DECLARE(apr_status_t) apr_stat(apr_f
>          if ((rv = test_safe_name(fname)) != APR_SUCCESS) {
>              return rv;
>          }
> -        hFind = FindFirstFileW(wfname, &FileInfo.w);
> +        hFind = FindFirstFileExW(wfname, FindExInfoBasic, &FileInfo.w,
> +                                 FindExSearchNameMatch, NULL, 0);
>          if (hFind == INVALID_HANDLE_VALUE)
>              return apr_get_os_error();
>          FindClose(hFind);
>
>