[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: svn commit: r1072519 - Add svn_stream_skip(), svn_stream_buffered(), svn_stream_supports_mark()

From: Julian Foad <julian.foad_at_wandisco.com>
Date: Thu, 02 Jun 2011 11:49:15 +0100

On Thu, 2011-06-02, Stefan Fuhrmann wrote:
> On 01.06.2011 17:06, Julian Foad wrote:
> >> svn_error_t *
> >> svn_stream_skip(svn_stream_t *stream, apr_size_t *len)
> >> {
> >> SVN_ERR_ASSERT(stream->skip_fn != NULL);
> > This should call the default skip implementation (which reads and
> > discards) when a stream doesn't implement its own skip function. That
> > way, 'skip' will be available on any generic stream, which is better
> > than the caller having to know (either implicitly or by calling a test
> > function) whether the stream has a skip function installed.
> Agreed.
> >> return stream->skip_fn(stream->baton, len);
> >> }
> >
> >> static svn_error_t *
> >> skip_handler_empty(void *baton, apr_size_t *count)
> >> {
> >> *count = 0;
> >> return SVN_NO_ERROR;
> >> }
> > I thought a skip handler was supposed to return an error when asked to
> > read past EOF. This one doesn't. Anyway, if we make the above change
> > then we can get rid of this handler; the empty stream doesn't need one.
> +1. This function is unlikely to be called for an empty
> stream anyways.
>
> >> static svn_boolean_t
> >> is_buffered_handler_empty(void *baton)
> >> {
> >> return FALSE;
> >> }
> > We don't need this handler, because there's a default for streams that
> > don't supply a handler.
> Back then, I had just discovered that translated streams (?)
> did not provide a specialized skip() implementation. That
> prompted me to look for any "missing" handler.
>
> But this one is indeed not needed.

Done in r1130490: "Change svn_stream_skip() so that if no skip handler
is provided it will still work by reading from the stream, and so remove
three trivial handlers."

- Julian
Received on 2011-06-02 12:49:56 CEST

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.