FreeBSD/contrib/subversion/subversion/libsvn_subr/stream.c
/* Helper function that creates a stream from an APR file. */
Helper function that creates a stream from an APR file.
Helper function that creates a stream from an APR file .
static svn_stream_t *
make_stream_from_apr_file(apr_file_t *file,
                          svn_boolean_t disown,
                          svn_boolean_t supports_seek,
                          apr_pool_t *pool)
{
  struct baton_apr *baton;
  svn_stream_t *stream;
  if (file == NULL)
    return svn_stream_empty(pool);
  baton = apr_palloc(pool, sizeof(*baton));
  baton->file = file;
  baton->pool = pool;
  stream = svn_stream_create(baton, pool);
  svn_stream_set_read2(stream, read_handler_apr, read_full_handler_apr);
  svn_stream_set_write(stream, write_handler_apr);
  if (supports_seek)
    {
      svn_stream_set_skip(stream, skip_handler_apr);
      svn_stream_set_mark(stream, mark_handler_apr);
      svn_stream_set_seek(stream, seek_handler_apr);
    }
  svn_stream_set_data_available(stream, data_available_handler_apr);
  svn_stream__set_is_buffered(stream, is_buffered_handler_apr);
  stream->file = file;
  if (! disown)
    svn_stream_set_close(stream, close_handler_apr);
  return stream;
}
static svn_stream_t * make_stream_from_apr_file ( apr_file_t * file , svn_boolean_t disown , svn_boolean_t supports_seek , apr_pool_t * pool ) { struct baton_apr * baton ; svn_stream_t * stream ; if ( file == NULL ) return svn_stream_empty ( pool ) ; baton = apr_palloc ( pool , sizeof ( * baton ) ) ; baton -> file = file ; baton -> pool = pool ; stream = svn_stream_create ( baton , pool ) ; svn_stream_set_read2 ( stream , read_handler_apr , read_full_handler_apr ) ; svn_stream_set_write ( stream , write_handler_apr ) ; if ( supports_seek ) { svn_stream_set_skip ( stream , skip_handler_apr ) ; svn_stream_set_mark ( stream , mark_handler_apr ) ; svn_stream_set_seek ( stream , seek_handler_apr ) ; } svn_stream_set_data_available ( stream , data_available_handler_apr ) ; svn_stream__set_is_buffered ( stream , is_buffered_handler_apr ) ; stream -> file = file ; if ( ! disown ) svn_stream_set_close ( stream , close_handler_apr ) ; return stream ; }
Helper function that creates a stream from an APR file.
Helper function that creates a stream from an APR file .