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;";