subversion-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Philip Martin <philip.mar...@wandisco.com>
Subject Re: [PATCH] Fix modification of nil value in Ruby test suite
Date Tue, 17 Nov 2015 13:40:14 GMT
James McCoy <jamessan@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?

-- 
Philip Martin
WANdisco

Mime
View raw message