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

Re: [PATCH] Fix modification of nil value in Ruby test suite

From: James McCoy <jamessan_at_debian.org>
Date: Tue, 17 Nov 2015 08:51:31 -0500

On Nov 17, 2015 8:40 AM, "Philip Martin" <philip.martin_at_wandisco.com> wrote:
>
> James McCoy <jamessan_at_debian.org> writes:
>
> > --- a/subversion/bindings/swig/ruby/libsvn_swig_ruby/swigutil_rb.c
> > +++ b/subversion/bindings/swig/ruby/libsvn_swig_ruby/swigutil_rb.c
> > @@ -3230,14 +3230,16 @@ svn_swig_rb_make_stream(VALUE io)
> > stream_p = &stream;
> > r2c_swig_type2(io, "svn_stream_t *", (void **)stream_p);
> > } else {
> > + if (NIL_P(io)) {
> > + io = rb_class_new_instance(0, NULL, rb_cObject);
> > + }
> > VALUE rb_pool = rb_pool_new(Qnil);
> > - apr_pool_wrapper_t *pool_wrapper;
> > - apr_pool_wrapper_t **pool_wrapper_p;
> > + apr_pool_t *pool;
> > +
> > + svn_swig_rb_get_pool(0, NULL, io, &rb_pool, &pool);
> >
> > rb_set_pool(io, rb_pool);
> > - pool_wrapper_p = &pool_wrapper;
> > - r2c_swig_type2(rb_pool, "apr_pool_wrapper_t *", (void
**)pool_wrapper_p);
> > - stream = svn_stream_create((void *)io, pool_wrapper->pool);
> > + stream = svn_stream_create((void *)io, pool);
> > svn_stream_set_read2(stream, NULL /* only full read support */,
> > read_handler_rbio);
> > svn_stream_set_write(stream, write_handler_rbio);
>
> That works when I try it but I'm not familar with Ruby. I know Ruby has
> GC but what controls the lifetime of the io object and how long does it
> need to persist?

Good questions. I don't know the answers, unfortunately. I just tried to
follow the style of other, similar code as I don't really grok Ruby's C API
and didn't find great documentation about it.

Cheers,
James
Received on 2015-11-17 14:51:44 CET

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