You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by cm...@apache.org on 2012/05/08 21:09:53 UTC

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

Author: cmpilato
Date: Tue May  8 19:09:52 2012
New Revision: 1335704

URL: http://svn.apache.org/viewvc?rev=1335704&view=rev
Log:
Another follow-up to r1335566: Avoid executing the (lazy) open_func()
callback only to immediately close the underlying stream.

* subversion/include/svn_io.h
  (svn_stream_lazyopen_create): Note that if all we do is create and
    then close the stream, the open_func callback won't get called.

* subversion/libsvn_subr/stream.c
  (close_handler_lazyopen): Avoid opening a stream simply to close it.

Suggested by: ivan

Modified:
    subversion/trunk/subversion/include/svn_io.h
    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=1335704&r1=1335703&r2=1335704&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_io.h (original)
+++ subversion/trunk/subversion/include/svn_io.h Tue May  8 19:09:52 2012
@@ -1349,6 +1349,9 @@ typedef svn_error_t *
  * invoked upon the first read of @a *stream which are used to open the
  * "real" source stream.
  *
+ * @note If the only "access" the returned stream gets is to close it,
+ * @a open_func will not be called.
+ *
  * @since New in 1.8.
  */
 svn_stream_t *

Modified: subversion/trunk/subversion/libsvn_subr/stream.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/stream.c?rev=1335704&r1=1335703&r2=1335704&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/stream.c (original)
+++ subversion/trunk/subversion/libsvn_subr/stream.c Tue May  8 19:09:52 2012
@@ -1747,8 +1747,8 @@ close_handler_lazyopen(void *baton)
 {
   lazyopen_baton_t *b = baton;
 
-  SVN_ERR(lazyopen_if_unopened(b));
-  SVN_ERR(svn_stream_close(b->real_stream));
+  if (b->real_stream != NULL)
+    SVN_ERR(svn_stream_close(b->real_stream));
 
   return SVN_NO_ERROR;
 }