From 6edd2e4561af6687ee9d61efd3ee61f52ac27db3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20K=C3=B6ppe?= Date: Fri, 10 Jun 2005 11:43:46 +0000 Subject: [PATCH] Fix for global "const char *" variables. Fix testcases arrays_dimensionless, arrays_global. git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@7272 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Lib/guile/typemaps.i | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Lib/guile/typemaps.i b/Lib/guile/typemaps.i index d6349bdca..6a6163215 100644 --- a/Lib/guile/typemaps.i +++ b/Lib/guile/typemaps.i @@ -8,10 +8,12 @@ %typemap(in) SWIGTYPE *, SWIGTYPE &, SWIGTYPE [] { $1 = ($1_ltype)SWIG_MustGetPtr($input, $descriptor, $argnum, 0); } +%typemap(freearg) SWIGTYPE *, SWIGTYPE &, SWIGTYPE [] ""; %typemap(in) void * { $1 = SWIG_MustGetPtr($input, NULL, $argnum, 0); } +%typemap(freearg) void * ""; %typemap(varin) SWIGTYPE * { $1 = ($1_ltype)SWIG_MustGetPtr($input, $descriptor, 1, 0); @@ -258,13 +260,17 @@ %typemap (freearg) char *OUTPUT, char *BOTH ""; -/* If we set a string variable, delete the old result first. */ +/* If we set a string variable, delete the old result first, unless const. */ %typemap (varin) char * { if ($1) free($1); $1 = SWIG_scm2str($input); } +%typemap (varin) const char * { + $1 = SWIG_scm2str($input); +} + /* Void */ %typemap (out,doc="") void "gswig_result = SCM_UNSPECIFIED;";