Description: Adjust code for building agaisnt SWIG 4.3
Author: Jitka Plesnikova <jplesnik@redhat.com>
Origin: other, https://src.fedoraproject.org/rpms/plplot/blob/rawhide/f/plplot-5.15.0-swig-4.3.patch
Bug-Debian: https://bugs.debian.org/1091121
Forwarded: not-needed
Reviewed-By: Rafael Laboissière <rafael@debian.org>
Last-Update: 2025-01-11

--- plplot-5.15.0+dfsg2.orig/bindings/java/plplotjavac.i
+++ plplot-5.15.0+dfsg2/bindings/java/plplotjavac.i
@@ -2128,9 +2128,9 @@ PLBOOL_OUTPUT_TYPEMAP( PLBOOL, jboolean,
 %typemap( argout ) PLGraphicsIn * gin {
     PyObject *o;
     o         = PyFloat_FromDouble( $1->wX );
-    resultobj = t_output_helper( resultobj, o );
+    resultobj = SWIG_AppendOutput( resultobj, o );
     o         = PyFloat_FromDouble( $1->wY );
-    resultobj = t_output_helper( resultobj, o );
+    resultobj = SWIG_AppendOutput( resultobj, o );
 }
 #endif
 
--- plplot-5.15.0+dfsg2.orig/bindings/octave/plplot_octave.i
+++ plplot-5.15.0+dfsg2/bindings/octave/plplot_octave.i
@@ -770,7 +770,7 @@ typedef PLINT          PLBOOL;
 }
 %typemap ( argout ) ( const PLFLT * ArrayY, PLINT ny, PLFLT * OutMatrixCk )
 {
-    $result = SWIG_Octave_AppendOutput( $result, retval$argnum( 0 ) );
+    $result = SWIG_AppendOutput( $result, retval$argnum( 0 ) );
 }
 %typemap ( freearg ) ( const PLFLT * ArrayY, PLINT ny, PLFLT * OutMatrixCk )
 {
@@ -796,7 +796,7 @@ typedef PLINT          PLBOOL;
     local_charMatrix    = charMatrix( 1, local_string_length );
     local_charMatrix.insert( local_string$argnum, 0, 0 );
     retval( 0 ) = octave_value( local_charMatrix );
-    $result     = SWIG_Octave_AppendOutput( $result, retval( 0 ) );
+    $result     = SWIG_AppendOutput( $result, retval( 0 ) );
 }
 
 typedef PLINT ( *defined_func )( PLFLT, PLFLT );
--- plplot-5.15.0+dfsg2.orig/bindings/python/fragments.i
+++ plplot-5.15.0+dfsg2/bindings/python/fragments.i
@@ -1,29 +1,2 @@
 /* Helper function to return tuples */
-
-%fragment("t_output_helper","header") %{
-  static PyObject* t_output_helper(PyObject* target, PyObject* o) {
-    PyObject*   o2;
-    PyObject*   o3;
-
-    if (!target) {
-        target = o;
-    } else if (target == Py_None) {
-        Py_DECREF(Py_None);
-        target = o;
-    } else {
-        if (!PyTuple_Check(target)) {
-	   o2 = target;
-	   target = PyTuple_New(1);
-	   PyTuple_SetItem(target, 0, o2);
-	}
-        o3 = PyTuple_New(1);
-        PyTuple_SetItem(o3, 0, o);
-
-        o2 = target;
-        target = PySequence_Concat(o2, o3);
-        Py_DECREF(o2);
-        Py_DECREF(o3);
-    }
-    return target;
-}
-%}
+/* Legacy - file can be deleted */
--- plplot-5.15.0+dfsg2.orig/bindings/python/plplotc.i
+++ plplot-5.15.0+dfsg2/bindings/python/plplotc.i
@@ -682,7 +682,7 @@ typedef PLINT          PLBOOL;
 }
 %typemap ( argout ) ( const PLFLT * ArrayY, PLINT ny, PLFLT **OutMatrixCk )
 {
-    $result = SWIG_Python_AppendOutput( $result, array$argnum );
+    $result = SWIG_AppendOutput( $result, array$argnum );
 }
 
 //**************************
@@ -749,9 +749,9 @@ typedef PLINT          PLBOOL;
 {
     $1 = buff;
 }
-%typemap( argout, fragment = "t_output_helper" ) char *OUTPUT {
+%typemap( argout ) char *OUTPUT {
     PyObject *o = PyString_FromString( $1 );
-    $result = t_output_helper( $result, o );
+    $result = SWIG_AppendOutput( $result, o );
 }
 
 //**************************
@@ -1662,9 +1662,9 @@ typedef void ( *label_func )( PLINT, PLF
 %typemap( argout ) PLGraphicsIn * gin {
     PyObject *o;
     o         = PyFloat_FromDouble( $1->wX );
-    resultobj = t_output_helper( resultobj, o );
+    resultobj = SWIG_AppendOutput( resultobj, o );
     o         = PyFloat_FromDouble( $1->wY );
-    resultobj = t_output_helper( resultobj, o );
+    resultobj = SWIG_AppendOutput( resultobj, o );
 }
 #endif
 
