Remove Ruby output_helper fragment and macro

Use SWIG_AppendOutput instead of output_helper (does not require the
output_helper macro).
This commit is contained in:
William S Fulton 2024-10-06 00:36:48 +01:00
parent d7c90c8f8f
commit 94e320f4b0
4 changed files with 17 additions and 8 deletions

View File

@ -7,6 +7,11 @@ the issue number to the end of the URL: https://github.com/swig/swig/issues/
Version 4.3.0 (in progress)
===========================
2024-10-05: wsfulton
[Ruby] Removed backwards compatible output_helper fragment and macro.
Use SWIG_AppendOutput instead of output_helper (does not require the
output_helper macro).
2024-10-05: wsfulton
[Ruby] #2907 Fix returning null from functions with output parameters.
Ensures OUTPUT and INOUT typemaps are handled consistently wrt return
@ -19,6 +24,15 @@ Version 4.3.0 (in progress)
The 3rd parameter is new and the new $isvoid special variable should be
passed to it, indicating whether or not the wrapped function returns void.
Also consider replacing with:
SWIG_AppendOutput(VALUE target, VALUE o);
which calls SWIG_Ruby_AppendOutput with same parameters but adding $isvoid
for final parameter.
*** POTENTIAL INCOMPATIBILITY ***
2024-09-29: clintonstimpson
[Python] #2350 Switch implementation from static types to heap
types using PyType_FromSpec() introduced in Python 3.

View File

@ -68,10 +68,10 @@ extern int count(char *bytes, int len, char c);
/* Return the mutated string as a new object. */
%typemap(argout, fragment="output_helper") (char *str, int len) {
%typemap(argout) (char *str, int len) {
VALUE o;
o = rb_str_new($1,$2);
$result = output_helper($result,o);
$result = SWIG_AppendOutput($result, o);
free($1);
}

View File

@ -4,7 +4,7 @@
%typemap(in, numinputs=0) SWIGTYPE ** ($*1_ltype temp) "$1 = &temp;"
%typemap(argout) SWIGTYPE **OUTPARAM {
$result = SWIG_Ruby_AppendOutput($result, SWIG_NewPointerObj(*$1, $*1_descriptor, 0));
$result = SWIG_AppendOutput($result, SWIG_NewPointerObj(*$1, $*1_descriptor, 0));
}
%apply SWIGTYPE **OUTPARAM {

View File

@ -20,11 +20,6 @@
/* Ruby fragments for char* strings */
%include <rubystrings.swg>
/* Backward compatibility output helper */
%fragment("output_helper","header") %{
#define output_helper SWIG_Ruby_AppendOutput
%}
/* ------------------------------------------------------------
* Unified typemap section
* ------------------------------------------------------------ */