Fix for new typemaps for handling parameters of type std::string & - add a

specialised form for const std::string & which does nothing to avoid leaking
memory whenever we pass a string by const reference.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9979 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Olly Betts 2007-10-10 14:35:44 +00:00
commit 41af8afda1

View file

@ -39,12 +39,6 @@ namespace std {
$1 = ( Z_TYPE_PP($input) == IS_STRING ) ? 1 : 0;
}
%typemap(in) const string & (std::string temp) {
convert_to_string_ex($input);
temp.assign(Z_STRVAL_PP($input), Z_STRLEN_PP($input));
$1 = &temp;
}
%typemap(out) string {
ZVAL_STRINGL($result, const_cast<char*>($1.data()), $1.size(), 1);
}
@ -72,4 +66,6 @@ namespace std {
%typemap(argout) string & {
ZVAL_STRINGL(*($input), const_cast<char*>($1->data()), $1->size(), 1);
}
%typemap(argout) const string & { }
}