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

Re: [PATCH] [RUBY] GC fixes

From: Kouhei Sutou <kou_at_cozmixng.org>
Date: 2006-04-13 10:21:38 CEST

Hi,

In <92f5f81d0604122322o7ca2275bj59e480c7424e3330@mail.gmail.com>
  "Re: [PATCH] [RUBY] GC fixes" on Wed, 12 Apr 2006 23:22:40 -0700,
  "Evan Phoenix" <evan@fallingsnow.net> wrote:

> I've attached a script that causes the problem.

Could you try the attached patch?

NOTE: This patch is for trunk. If you can't apply the patch
cleanly, I'll remake a patch for 1.3.1.

Thanks,

--
kou

Index: subversion/bindings/swig/ruby/libsvn_swig_ruby/swigutil_rb.h
===================================================================
--- subversion/bindings/swig/ruby/libsvn_swig_ruby/swigutil_rb.h (revision 19340)
+++ subversion/bindings/swig/ruby/libsvn_swig_ruby/swigutil_rb.h (working copy)
@@ -87,6 +87,7 @@
                                    apr_pool_t *pool);
 
 VALUE svn_swig_rb_make_baton(VALUE proc, VALUE pool);
+void svn_swig_rb_set_baton(VALUE target, VALUE baton);
 
 svn_error_t *svn_swig_rb_log_receiver(void *baton,
                                       apr_hash_t *changed_paths,
Index: subversion/bindings/swig/ruby/libsvn_swig_ruby/swigutil_rb.c
===================================================================
--- subversion/bindings/swig/ruby/libsvn_swig_ruby/swigutil_rb.c (revision 19340)
+++ subversion/bindings/swig/ruby/libsvn_swig_ruby/swigutil_rb.c (working copy)
@@ -994,6 +994,12 @@
   VALUE baton;
 } item_baton;
 
+static void
+add_baton(VALUE editor, VALUE baton)
+{
+ rb_ary_push(rb_ivar_get(editor, rb_id_baton()), baton);
+}
+
 static item_baton *
 make_baton(apr_pool_t *pool, VALUE editor, VALUE baton)
 {
@@ -1001,12 +1007,36 @@
 
   newb->editor = editor;
   newb->baton = baton;
- rb_ary_push(rb_ivar_get(editor, rb_id_baton()), baton);
+ add_baton(editor, baton);
 
   return newb;
 }
 
+static VALUE
+add_baton_if_delta_editor(VALUE target, VALUE baton)
+{
+ if (RTEST(rb_obj_is_kind_of(target, svn_swig_rb_svn_delta_editor()))) {
+ add_baton(target, baton);
+ }
 
+ return Qnil;
+}
+
+void
+svn_swig_rb_set_baton(VALUE target, VALUE baton)
+{
+ if (NIL_P(baton)) {
+ return;
+ }
+
+ if (!RTEST(rb_obj_is_kind_of(target, rb_cArray))) {
+ target = rb_ary_new3(1, target);
+ }
+
+ rb_iterate(rb_each, target, add_baton_if_delta_editor, baton);
+}
+
+
 static svn_error_t *
 delta_editor_set_target_revision(void *edit_baton,
                                  svn_revnum_t target_revision,
Index: subversion/bindings/swig/include/svn_types.swg
===================================================================
--- subversion/bindings/swig/include/svn_types.swg (revision 19340)
+++ subversion/bindings/swig/include/svn_types.swg (working copy)
@@ -434,6 +434,11 @@
   $2 = (void *)svn_swig_rb_make_baton($input, _global_svn_swig_rb_pool);
 };
 
+%typemap(ruby, argout) (svn_commit_callback2_t callback, void *callback_baton)
+{
+ svn_swig_rb_set_baton($result, $2);
+};
+
 /* -----------------------------------------------------------------------
    Callback: svn_cancel_func_t
 */

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Thu Apr 13 10:22:16 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.