You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2015/03/23 13:00:08 UTC

svn commit: r1668608 - in /subversion/trunk/subversion: include/svn_io.h libsvn_subr/io.c libsvn_subr/stream.c

Author: stefan2
Date: Mon Mar 23 12:00:08 2015
New Revision: 1668608

URL: http://svn.apache.org/r1668608
Log:
Update pool argument names in functions added to the svn_io.h API in 1.9.
No functional change intended.

* subversion/include/svn_io.h
  (svn_io_file_create_bytes,
   svn_io_file_create_empty): The pool argument is actually a SCRATCH_POOL.
  (svn_stringbuf_from_stream): The pool argument is a pure RESULT_POOL.
  (svn_io_file_aligned_seek): The pool argument is actually a SCRATCH_POOL.

* subversion/libsvn_subr/io.c
  (svn_io_file_create_bytes, 
   svn_io_file_create_empty,
   svn_io_file_aligned_seek): Update implementation. 

* subversion/libsvn_subr/stream.c
  (svn_stringbuf_from_stream): Same.

Modified:
    subversion/trunk/subversion/include/svn_io.h
    subversion/trunk/subversion/libsvn_subr/io.c
    subversion/trunk/subversion/libsvn_subr/stream.c

Modified: subversion/trunk/subversion/include/svn_io.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_io.h?rev=1668608&r1=1668607&r2=1668608&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_io.h (original)
+++ subversion/trunk/subversion/include/svn_io.h Mon Mar 23 12:00:08 2015
@@ -707,7 +707,7 @@ svn_io_file_create(const char *file,
  * Write the data in 'binary' mode (#APR_FOPEN_BINARY). If @a length is
  * zero, create an empty file; in this case @a contents may be @c NULL.
  *
- * Use @a pool for memory allocations.
+ * Use @a scratch_pool for temporary allocations.
  *
  * @since New in 1.9.
  */
@@ -715,20 +715,20 @@ svn_error_t *
 svn_io_file_create_bytes(const char *file,
                          const void *contents,
                          apr_size_t length,
-                         apr_pool_t *pool);
+                         apr_pool_t *scratch_pool);
 
 /** Create an empty file at utf8-encoded path @a file.
  *
  * @a file must not already exist. If an error occurs while
  * closing the file, attempt to delete the file before returning the error.
  *
- * Use @a pool for memory allocations.
+ * Use @a scratch_pool for temporary allocations.
  *
  * @since New in 1.9.
  */
 svn_error_t *
 svn_io_file_create_empty(const char *file,
-                         apr_pool_t *pool);
+                         apr_pool_t *scratch_pool);
 
 /**
  * Lock file at @a lock_file. If @a exclusive is TRUE,
@@ -1129,8 +1129,8 @@ svn_error_t *
 svn_stream_for_stdout(svn_stream_t **out,
                       apr_pool_t *pool);
 
-/** Set @a *str to a string buffer allocated in @a pool that contains all
- * data from the current position in @a stream to its end.  @a len_hint
+/** Set @a *str to a string buffer allocated in @a result_pool that contains
+ * all data from the current position in @a stream to its end.  @a len_hint
  * specifies the initial capacity of the string buffer and may be 0.  The
  * buffer gets automatically resized to fit the actual amount of data being
  * read from @a stream.
@@ -1141,7 +1141,7 @@ svn_error_t *
 svn_stringbuf_from_stream(svn_stringbuf_t **str,
                           svn_stream_t *stream,
                           apr_size_t len_hint,
-                          apr_pool_t *pool);
+                          apr_pool_t *result_pool);
 
 /** Return a generic stream connected to stringbuf @a str.  Allocate the
  * stream in @a pool.
@@ -2225,7 +2225,7 @@ svn_io_file_seek(apr_file_t *file,
  * internal data buffer to @a block_size bytes and to read data aligned to
  * multiples of that value.  The beginning of the block will be returned
  * in @a buffer_start, if that is not NULL.
- * Uses @a pool for temporary allocations.
+ * Uses @a scratch_pool for temporary allocations.
  *
  * @note Due to limitations of the APR API, the alignment may not be
  * successful.  If you never use any other seek function on @a file,
@@ -2241,7 +2241,7 @@ svn_io_file_aligned_seek(apr_file_t *fil
                          apr_off_t block_size,
                          apr_off_t *buffer_start,
                          apr_off_t offset,
-                         apr_pool_t *pool);
+                         apr_pool_t *scratch_pool);
 
 /** Wrapper for apr_file_write(). */
 svn_error_t *

Modified: subversion/trunk/subversion/libsvn_subr/io.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/io.c?rev=1668608&r1=1668607&r2=1668608&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/io.c (original)
+++ subversion/trunk/subversion/libsvn_subr/io.c Mon Mar 23 12:00:08 2015
@@ -1191,7 +1191,7 @@ svn_error_t *
 svn_io_file_create_bytes(const char *file,
                          const void *contents,
                          apr_size_t length,
-                         apr_pool_t *pool)
+                         apr_pool_t *scratch_pool)
 {
   apr_file_t *f;
   apr_size_t written;
@@ -1200,13 +1200,14 @@ svn_io_file_create_bytes(const char *fil
   SVN_ERR(svn_io_file_open(&f, file,
                            (APR_WRITE | APR_CREATE | APR_EXCL),
                            APR_OS_DEFAULT,
-                           pool));
+                           scratch_pool));
   if (length)
-    err = svn_io_file_write_full(f, contents, length, &written, pool);
+    err = svn_io_file_write_full(f, contents, length, &written,
+                                 scratch_pool);
 
   err = svn_error_compose_create(
                     err,
-                    svn_io_file_close(f, pool));
+                    svn_io_file_close(f, scratch_pool));
 
   if (err)
     {
@@ -1216,7 +1217,7 @@ svn_io_file_create_bytes(const char *fil
       return svn_error_trace(
                 svn_error_compose_create(
                     err,
-                    svn_io_remove_file2(file, TRUE, pool)));
+                    svn_io_remove_file2(file, TRUE, scratch_pool)));
     }
 
   return SVN_NO_ERROR;
@@ -1235,9 +1236,10 @@ svn_io_file_create(const char *file,
 
 svn_error_t *
 svn_io_file_create_empty(const char *file,
-                         apr_pool_t *pool)
+                         apr_pool_t *scratch_pool)
 {
-  return svn_error_trace(svn_io_file_create_bytes(file, NULL, 0, pool));
+  return svn_error_trace(svn_io_file_create_bytes(file, NULL, 0,
+                                                  scratch_pool));
 }
 
 svn_error_t *
@@ -3633,7 +3635,7 @@ svn_io_file_aligned_seek(apr_file_t *fil
                          apr_off_t block_size,
                          apr_off_t *buffer_start,
                          apr_off_t offset,
-                         apr_pool_t *pool)
+                         apr_pool_t *scratch_pool)
 {
   const apr_size_t apr_default_buffer_size = 4096;
   apr_size_t file_buffer_size = apr_default_buffer_size;
@@ -3683,7 +3685,7 @@ svn_io_file_aligned_seek(apr_file_t *fil
          buffer and no I/O will actually happen in the FILL_BUFFER
          section below.
        */
-      SVN_ERR(svn_io_file_seek(file, APR_CUR, &current, pool));
+      SVN_ERR(svn_io_file_seek(file, APR_CUR, &current, scratch_pool));
       fill_buffer = aligned_offset + file_buffer_size <= current
                  || current <= aligned_offset;
     }
@@ -3694,7 +3696,8 @@ svn_io_file_aligned_seek(apr_file_t *fil
       apr_status_t status;
 
       /* seek to the start of the block and cause APR to read 1 block */
-      SVN_ERR(svn_io_file_seek(file, APR_SET, &aligned_offset, pool));
+      SVN_ERR(svn_io_file_seek(file, APR_SET, &aligned_offset,
+                               scratch_pool));
       status = apr_file_getc(&dummy, file);
 
       /* read may fail if we seek to or behind EOF.  That's ok then. */
@@ -3702,17 +3705,17 @@ svn_io_file_aligned_seek(apr_file_t *fil
         return do_io_file_wrapper_cleanup(file, status,
                                           N_("Can't read file '%s'"),
                                           N_("Can't read stream"),
-                                          pool);
+                                          scratch_pool);
     }
 
   /* finally, seek to the OFFSET the caller wants */
   desired_offset = offset;
-  SVN_ERR(svn_io_file_seek(file, APR_SET, &offset, pool));
+  SVN_ERR(svn_io_file_seek(file, APR_SET, &offset, scratch_pool));
   if (desired_offset != offset)
     return do_io_file_wrapper_cleanup(file, APR_EOF,
                                       N_("Can't seek in file '%s'"),
                                       N_("Can't seek in stream"),
-                                      pool);
+                                      scratch_pool);
 
   /* return the buffer start that we (probably) enforced */
   if (buffer_start)

Modified: subversion/trunk/subversion/libsvn_subr/stream.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/stream.c?rev=1668608&r1=1668607&r2=1668608&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/stream.c (original)
+++ subversion/trunk/subversion/libsvn_subr/stream.c Mon Mar 23 12:00:08 2015
@@ -1443,13 +1443,14 @@ svn_error_t *
 svn_stringbuf_from_stream(svn_stringbuf_t **str,
                           svn_stream_t *stream,
                           apr_size_t len_hint,
-                          apr_pool_t *pool)
+                          apr_pool_t *result_pool)
 {
 #define MIN_READ_SIZE 64
 
   apr_size_t to_read = 0;
   svn_stringbuf_t *text
-    = svn_stringbuf_create_ensure(len_hint ? len_hint : MIN_READ_SIZE, pool);
+    = svn_stringbuf_create_ensure(len_hint ? len_hint : MIN_READ_SIZE,
+                                  result_pool);
 
   do
     {