On Tue, 25 Jun 2019 at 17:21, <jor...@apache.org> wrote:

> Author: jorton
> Date: Tue Jun 25 14:21:56 2019
> New Revision: 1862071
>
> URL: http://svn.apache.org/viewvc?rev=1862071&view=rev
> Log:
> Add apr_dir_pread(), a variant of apr_dir_read() which allows callers
> to read a directory with constant memory consumption:
>
> * include/apr_file_info.h: Add warning on memory consumption for
>   apr_dir_read; declare apr_dir_pread.
>
> * file_io/unix/dir.c (apr_dir_pread): Rename from apr_dir_read and
>   take pool argument.  (apr_dir_read): Reimplement using it.
>
> * file_io/win32/dir.c, file_io/os2/dir.c: Likewise, but untested.


> * test/testdir.c (test_pread) [APR_POOL_DEBUG]: Add test case.
>
> I'm not sure it's best fix. Better solution would be allocate buffer for
dirname + MAX_FILE_NAME in apr_dir_t and reuse it on every iteration. Win32
already has such code.


-- 
Ivan Zhakov

Reply via email to