aaron 02/01/23 20:28:09
Modified: include apr_file_io.h
test testdup.c
file_io/os2 filedup.c
file_io/unix filedup.c
file_io/win32 filedup.c
Log:
Change the new_file parameter of apr_file_dup2() so that it is perfectly
clear that it takes an old apr_file_t* object and doesn't create a new
one. This makes the function signatures of apr_file_dup() and
apr_file_dup2() distinct.
Reviewed by: William Rowe
Revision Changes Path
1.115 +2 -2 apr/include/apr_file_io.h
Index: apr_file_io.h
===================================================================
RCS file: /home/cvs/apr/include/apr_file_io.h,v
retrieving revision 1.114
retrieving revision 1.115
diff -u -r1.114 -r1.115
--- apr_file_io.h 18 Jan 2002 19:24:09 -0000 1.114
+++ apr_file_io.h 24 Jan 2002 04:28:08 -0000 1.115
@@ -392,13 +392,13 @@
/**
* duplicate the specified file descriptor and close the original
- * @param new_file The structure to duplicate into
+ * @param new_file The old file that is to be closed and reused
* @param old_file The file to duplicate
* @param p The pool to use for the new file
*
* @remark *arg1 MUST point at a valid apr_file_t. It cannot point at NULL
*/
-APR_DECLARE(apr_status_t) apr_file_dup2(apr_file_t **new_file,
+APR_DECLARE(apr_status_t) apr_file_dup2(apr_file_t *new_file,
apr_file_t *old_file,
apr_pool_t *p);
1.4 +1 -1 apr/test/testdup.c
Index: testdup.c
===================================================================
RCS file: /home/cvs/apr/test/testdup.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- testdup.c 12 Jan 2002 20:34:07 -0000 1.3
+++ testdup.c 24 Jan 2002 04:28:08 -0000 1.4
@@ -111,7 +111,7 @@
APR_READ | APR_WRITE | APR_CREATE,
APR_OS_DEFAULT, p))
- STD_TEST_NEQ(" Dup2 test", apr_file_dup2(&file3, file2, p))
+ STD_TEST_NEQ(" Dup2 test", apr_file_dup2(file3, file2, p))
txtlen = sizeof(TEST2);
STD_TEST_NEQ(" Write to dup'd file #3", apr_file_write(file3, TEST2,
&txtlen))
1.25 +2 -6 apr/file_io/os2/filedup.c
Index: filedup.c
===================================================================
RCS file: /home/cvs/apr/file_io/os2/filedup.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- filedup.c 20 Jan 2002 06:41:50 -0000 1.24
+++ filedup.c 24 Jan 2002 04:28:09 -0000 1.25
@@ -113,11 +113,7 @@
-APR_DECLARE(apr_status_t) apr_file_dup2(apr_file_t **new_file, apr_file_t
*old_file, apr_pool_t *p)
+APR_DECLARE(apr_status_t) apr_file_dup2(apr_file_t *new_file, apr_file_t
*old_file, apr_pool_t *p)
{
- if (*new_file == NULL) {
- return APR_EINVAL;
- }
-
- return file_dup(new_file, old_file, p);
+ return file_dup(&new_file, old_file, p);
}
1.44 +3 -3 apr/file_io/unix/filedup.c
Index: filedup.c
===================================================================
RCS file: /home/cvs/apr/file_io/unix/filedup.c,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -r1.43 -r1.44
--- filedup.c 14 Jan 2002 22:33:21 -0000 1.43
+++ filedup.c 24 Jan 2002 04:28:09 -0000 1.44
@@ -138,13 +138,13 @@
}
-APR_DECLARE(apr_status_t) apr_file_dup2(apr_file_t **new_file,
+APR_DECLARE(apr_status_t) apr_file_dup2(apr_file_t *new_file,
apr_file_t *old_file, apr_pool_t *p)
{
#ifdef NETWARE
- return _file_dup(new_file, old_file, p, 1);
+ return _file_dup(&new_file, old_file, p, 1);
#else
- return _file_dup(new_file, old_file, p, 2);
+ return _file_dup(&new_file, old_file, p, 2);
#endif
}
1.38 +8 -8 apr/file_io/win32/filedup.c
Index: filedup.c
===================================================================
RCS file: /home/cvs/apr/file_io/win32/filedup.c,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -r1.37 -r1.38
--- filedup.c 11 Jan 2002 10:19:03 -0000 1.37
+++ filedup.c 24 Jan 2002 04:28:09 -0000 1.38
@@ -94,7 +94,7 @@
}
-APR_DECLARE(apr_status_t) apr_file_dup2(apr_file_t **new_file,
+APR_DECLARE(apr_status_t) apr_file_dup2(apr_file_t *new_file,
apr_file_t *old_file, apr_pool_t *p)
{
DWORD stdhandle = -1;
@@ -134,17 +134,17 @@
FALSE, DUPLICATE_SAME_ACCESS)) {
return apr_get_os_error();
}
- if ((*new_file)->filehand) {
- CloseHandle((*new_file)->filehand);
+ if (new_file->filehand) {
+ CloseHandle(new_file->filehand);
}
newflags = old_file->flags & ~APR_INHERIT;
}
- (*new_file)->flags = newflags;
- (*new_file)->filehand = newhand;
- (*new_file)->fname = apr_pstrdup((*new_file)->cntxt, old_file->fname);
- (*new_file)->append = old_file->append;
- (*new_file)->buffered = FALSE;
+ new_file->flags = newflags;
+ new_file->filehand = newhand;
+ new_file->fname = apr_pstrdup(new_file->cntxt, old_file->fname);
+ new_file->append = old_file->append;
+ new_file->buffered = FALSE;
return APR_SUCCESS;
}