Author: jun66j5
Date: Wed Oct 23 10:44:41 2024
New Revision: 1921506

URL: http://svn.apache.org/viewvc?rev=1921506&view=rev
Log:
Make swig-rb compatible with SWIG 4.3.0.

* subversion/bindings/swig/include/svn_containers.swg
  (%typemap(out) apr_hash_t *PROPHASH,
   %typemap(out) apr_hash_t *CHANGED_PATH_HASH,
   %typemap(out) apr_array_header_t *PROP_LIST,
   %typemap(out) apr_array_header_t *PROP_LIST_MAY_BE_NULL):
    Set the return value to `$result` rather than using `%append_output` in
    `%typemap(out)` for Ruby.

* subversion/bindings/swig/include/svn_types.swg
  (%typemap(out) svn_error_t *):
    Initialize `$result` with an empty array for the workaround to
    `%append_output` incorrectly handling for nil and a list in Ruby.

  (%typemap(ret) svn_error_t *):
    Use first entry for `$result` when the size of the `$result` list is 1.

* subversion/bindings/swig/ruby/svn/core.rb
  (Svn::Core::RangeList.diff):
    Revised because multiple values are correctly retrieved from SWIG methods
    now.

* subversion/bindings/swig/svn_wc.i
  (%typemap(ret) svn_error_t *err):
    Added because `%typemap(out) svn_error_t *err` is defined.

Modified:
    subversion/trunk/subversion/bindings/swig/include/svn_containers.swg
    subversion/trunk/subversion/bindings/swig/include/svn_types.swg
    subversion/trunk/subversion/bindings/swig/ruby/svn/core.rb
    subversion/trunk/subversion/bindings/swig/svn_wc.i

Modified: subversion/trunk/subversion/bindings/swig/include/svn_containers.swg
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/swig/include/svn_containers.swg?rev=1921506&r1=1921505&r2=1921506&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/swig/include/svn_containers.swg 
(original)
+++ subversion/trunk/subversion/bindings/swig/include/svn_containers.swg Wed 
Oct 23 10:44:41 2024
@@ -310,7 +310,7 @@
 
 %typemap(out) apr_hash_t *PROPHASH
 {
-  %append_output(svn_swig_rb_apr_hash_to_hash_svn_string($1));
+  $result = svn_swig_rb_apr_hash_to_hash_svn_string($1);
 }
 #endif
 
@@ -326,10 +326,8 @@
 #ifdef SWIGRUBY
 %typemap(out) apr_hash_t *CHANGED_PATH_HASH
 {
-  VALUE rb_changed_path_hash;
-  rb_changed_path_hash =
+  $result =
     svn_swig_rb_apr_hash_to_hash_swig_type($1, "svn_log_changed_path_t *");
-  %append_output(rb_changed_path_hash);
 }
 
 %apply apr_hash_t *CHANGED_PATH_HASH {
@@ -760,7 +758,7 @@
 
 %typemap(out) apr_array_header_t *PROP_LIST
 {
-  %append_output(svn_swig_rb_prop_apr_array_to_hash_prop($1));
+  $result = svn_swig_rb_prop_apr_array_to_hash_prop($1);
 }
 
 %typemap(in) apr_array_header_t *PROP_LIST_MAY_BE_NULL
@@ -778,7 +776,7 @@
 
 %typemap(out) apr_array_header_t *PROP_LIST_MAY_BE_NULL
 {
-  %append_output($1 ? svn_swig_rb_prop_apr_array_to_hash_prop($1) : Qnil);
+  $result = $1 ? svn_swig_rb_prop_apr_array_to_hash_prop($1) : Qnil;
 }
 
 %apply apr_array_header_t *PROP_LIST {

Modified: subversion/trunk/subversion/bindings/swig/include/svn_types.swg
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/swig/include/svn_types.swg?rev=1921506&r1=1921505&r2=1921506&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/swig/include/svn_types.swg (original)
+++ subversion/trunk/subversion/bindings/swig/include/svn_types.swg Wed Oct 23 
10:44:41 2024
@@ -532,14 +532,29 @@ svn_ ## TYPE ## _swig_rb_closed(VALUE se
 #endif
 
 #ifdef SWIGRUBY
-%typemap(out) svn_error_t *
+%typemap(out) svn_error_t * (VALUE *svn_presult = NULL)
 {
   if ($1) {
     svn_swig_rb_destroy_pool(_global_svn_swig_rb_pool);
     svn_swig_rb_pop_pool(_global_svn_swig_rb_pool);
     svn_swig_rb_handle_svn_error($1);
   }
-  $result = Qnil;
+  $result = rb_ary_new();
+  svn_presult = &$result;
+}
+
+%typemap(ret) svn_error_t *
+{
+  if (TYPE(*svn_presult) == T_ARRAY) {
+    switch (rb_array_len(*svn_presult)) {
+      case 0:
+        *svn_presult = Qnil;
+        break;
+      case 1:
+        *svn_presult = rb_ary_entry(*svn_presult, 0);
+        break;
+    }
+  }
 }
 #endif
 

Modified: subversion/trunk/subversion/bindings/swig/ruby/svn/core.rb
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/swig/ruby/svn/core.rb?rev=1921506&r1=1921505&r2=1921506&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/swig/ruby/svn/core.rb (original)
+++ subversion/trunk/subversion/bindings/swig/ruby/svn/core.rb Wed Oct 23 
10:44:41 2024
@@ -812,7 +812,7 @@ module Svn
       def diff(to, consider_inheritance=false)
         result = Core.rangelist_diff(self, to, consider_inheritance)
         deleted = result.pop
-        added = result
+        added = result.pop
         [added, deleted].collect do |result|
           self.class.new(*result)
         end

Modified: subversion/trunk/subversion/bindings/swig/svn_wc.i
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/swig/svn_wc.i?rev=1921506&r1=1921505&r2=1921506&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/swig/svn_wc.i (original)
+++ subversion/trunk/subversion/bindings/swig/svn_wc.i Wed Oct 23 10:44:41 2024
@@ -242,6 +242,8 @@
 {
   $result = $1 ? svn_swig_rb_svn_error_to_rb_error($1) : Qnil;
 }
+
+%typemap(ret) svn_error_t *err "";
 #endif
 
 


Reply via email to