diff options
author | Ian Lance Taylor <iant@golang.org> | 2015-05-04 17:16:44 -0700 |
---|---|---|
committer | Ian Lance Taylor <iant@golang.org> | 2015-05-04 17:16:44 -0700 |
commit | e044dc440591cc8487cb9fb9b8c0d4808f98d568 (patch) | |
tree | 96f16cb6245d4023dfbba92e697a1c14dfe74d09 /Examples/go/multimap | |
parent | 48263f48028aef62a7a162ca869050cf62ff8b15 (diff) | |
download | swig-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.i | 9 |
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); |