aboutsummaryrefslogtreecommitdiff
path: root/Examples/go/multimap
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2015-05-04 17:16:44 -0700
committerIan Lance Taylor <iant@golang.org>2015-05-04 17:16:44 -0700
commite044dc440591cc8487cb9fb9b8c0d4808f98d568 (patch)
tree96f16cb6245d4023dfbba92e697a1c14dfe74d09 /Examples/go/multimap
parent48263f48028aef62a7a162ca869050cf62ff8b15 (diff)
downloadswig-e044dc440591cc8487cb9fb9b8c0d4808f98d568.tar.gz
[Go] Fix Go multimap example to use Swig_AllocateString and swigCopyString.
Diffstat (limited to 'Examples/go/multimap')
-rw-r--r--Examples/go/multimap/example.i9
1 files changed, 7 insertions, 2 deletions
diff --git a/Examples/go/multimap/example.i b/Examples/go/multimap/example.i
index 8de6b0dc3..30a37d3bf 100644
--- a/Examples/go/multimap/example.i
+++ b/Examples/go/multimap/example.i
@@ -74,16 +74,21 @@ extern int count(char *bytes, int len, char c);
%}
/* Return the mutated string as a modified element in the array. */
-%typemap(argout) (char *str, int len)
+%typemap(argout,fragment="AllocateString") (char *str, int len)
%{
{
_gostring_ *a;
a = (_gostring_*) $input.array;
- a[0] = _swig_makegostring($1, $2);
+ a[0] = Swig_AllocateString($1, $2);
}
%}
+%typemap(goargout,fragment="CopyString") (char *str, int len)
+%{
+ $input[0] = swigCopyString($input[0])
+%}
+
%typemap(freearg) (char *str, int len)
%{
free($1);