summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJoe Orton <jorton@apache.org>2019-07-02 15:58:19 +0000
committerJoe Orton <jorton@apache.org>2019-07-02 15:58:19 +0000
commit16dec5dc362e0729d0f4853bcb34344998879a6c (patch)
treeab25ac68f06b5426d1d402196046645e2a6e8d8e /include
parent167ba32c4f738bb76874c246b8f6a95fa87cc893 (diff)
downloadapr-16dec5dc362e0729d0f4853bcb34344998879a6c.tar.gz
* include/apr_file_info.h: Clarify pool handling for apr_dir_read and
apr_dir_pread. * file_io/win32/dir.c, file_io/os2/dir.c (apr_dir_read): Duplicate the returned filename so the call has no side-effects on apr_finfo_t structures passed to previous invocations of the function. * test/testdir.c (test_read_side_effects): Add test case for side-effects of apr_dir_read. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1862435 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'include')
-rw-r--r--include/apr_file_info.h12
1 files changed, 9 insertions, 3 deletions
diff --git a/include/apr_file_info.h b/include/apr_file_info.h
index f08762cea..0cf34ff06 100644
--- a/include/apr_file_info.h
+++ b/include/apr_file_info.h
@@ -257,15 +257,18 @@ APR_DECLARE(apr_status_t) apr_dir_close(apr_dir_t *thedir);
* @param wanted The desired apr_finfo_t fields, as a bit flag of APR_FINFO_
values
* @param thedir the directory descriptor returned from apr_dir_open
+ *
* @remark No ordering is guaranteed for the entries read.
+ * @c finfo->pool is set to the pool used to create @a thedir,
+ * and @c finfo->name is allocated from that pool.
*
* @note If @c APR_INCOMPLETE is returned all the fields in @a finfo may
* not be filled in, and you need to check the @c finfo->valid bitmask
* to verify that what you're looking for is there. When no more
* entries are available, APR_ENOENT is returned.
*
- * @warning Memory will be allocated in the pool passed to apr_dir_open;
- * use apr_dir_pread() and a temporary pool to restrict memory
+ * @warning Allocations will use the directory pool; use
+ * apr_dir_pread() and a temporary pool to restrict memory
* consumption for a large directory.
*/
APR_DECLARE(apr_status_t) apr_dir_read(apr_finfo_t *finfo, apr_int32_t wanted,
@@ -278,7 +281,10 @@ APR_DECLARE(apr_status_t) apr_dir_read(apr_finfo_t *finfo, apr_int32_t wanted,
values
* @param thedir the directory descriptor returned from apr_dir_open
* @param pool the pool to use for allocations
- * @remark No ordering is guaranteed for the entries read.
+
+ * @remark No ordering is guaranteed for the entries read.
+ * @remark @c finfo->pool is set to @a pool, and @c finfo->name is
+ * allocated from that pool.
*
* @note If @c APR_INCOMPLETE is returned all the fields in @a finfo may
* not be filled in, and you need to check the @c finfo->valid bitmask