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

Re: Subversion generic streams

From: Greg Stein <gstein_at_lyra.org>
Date: 2000-12-12 22:51:26 CET

On Tue, Dec 12, 2000 at 10:34:43AM -0500, Greg Hudson wrote:
>...
> > struct read_string *rs;
>
> > rs = NEW (pool, struct read_string);
> > rs->contents = some string;
> > rs->offset = 0;
>
> > *contents_p = read_string_fn;
> > *contents_baton_p = rs;
>
> For what I had in mind, the last two lines would be:
>
> *stream = svn_stream_create (rs);
> svn_stream_set_read (*stream, read_string_fn);
>
> and that's the only difference.

Even easier:

    *stream = svn_stream_create(pool, rs, read_string_fn, NULL /* write */,
                                NULL /* seek */);

One simple entry point which takes the appropriate functions and the baton.

It would also be simple to have utility functions:

    svn_stream_create_ro(pool, rs, read_string_fn);
    svn_stream_create_wo(pool, rs, write_string_fn);

(seekable or read/write streams would use the full create() function; or we
 could create _ros(...) and _wos(...) for seekable forms)

Note that it remains quite easy for the creator of the stream. The user of
the stream would no longer call the read/write functions directly, but would
go through svn_stream_read() type functions.

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/
Received on Sat Oct 21 14:36:17 2006

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.