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

Re: svn commit: rev 1101 - trunk/subversion/bindings/ruby

From: Greg Stein <gstein_at_lyra.org>
Date: 2002-01-29 09:46:48 CET

On Tue, Jan 29, 2002 at 01:52:17AM -0600, yoshiki@tigris.org wrote:
> Author: yoshiki
> Date: 2002-01-29 07:52 GMT
> New Revision: 1101
>
> Modified:
> trunk/subversion/bindings/ruby/txdelta.c
> Log:
> Sync with latest change. Now svn_txdelta_window_t has its own pool
> so no need to refcount parent's pool.
>
> (struct svn_ruby_txdelta_window_t): Add new member pool, which is
> associated with this object.
> (send_string): Use svn_string_t instead of svn_stringbuf_t.
> (free_txdelta_window): Remove refcount stuff. Destroy pool.
> (free_txdelta_stream): Remove call to svn_txdelta_free.
> (txdelta_stream_init): Remove instance variables used for refcount.
> (txdelta_stream_close): Remove refcount stuff.
> (txdelta_stream_next_window): Pass in pool. Remove refcount stuff.

Wow! Looks like there were a lot of simplifications you could make in there.
Very cool. I'm also glad it wasn't too difficult to fix up that code.

>...
> +++ NEW/trunk/subversion/bindings/ruby/txdelta.c Tue Jan 29 01:52:10 2002
>...
> static VALUE
> send_string (VALUE self, VALUE aStr)
> {
> - svn_stringbuf_t *string;
> + svn_string_t *string;
> apr_pool_t *pool;
> svn_error_t *err;
> svn_ruby_txdelta_t *delta;
> @@ -161,7 +162,7 @@
> Check_Type (aStr, T_STRING);
>
> pool = svn_pool_create (delta->pool);
> - string = svn_stringbuf_create (StringValuePtr (aStr), pool);
> + string = svn_string_create (StringValuePtr (aStr), pool);
>
> err = svn_txdelta_send_string (string, delta->handler, delta->handler_baton,
> pool);

You could do something like this:

    svn_string_t string;

    string.data = StringValuePtr (aStr);
    string.len = strlen (string.data);
    err = svn_txdelta_send_string (&string, ...);

In other words, you don't actually have to allocate the string structure on
the heap. You just need to pass a pointer to the _send_string() function.

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Oct 21 14:37:01 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.