[PHP] Use std::string::assign(PTR, LEN) rather than assigning

std::string(PTR, LEN).  Using assign generates more efficient code
(tested with GCC 4.1.2).


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9935 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Olly Betts 2007-09-17 18:39:12 +00:00
commit ef4ca158de
2 changed files with 8 additions and 2 deletions

View file

@ -1,5 +1,11 @@
Version 1.3.32 (in progress)
============================
09/17/2007: olly
[PHP] Use std::string::assign(PTR, LEN) rather than assigning
std::string(PTR, LEN). Using assign generates more efficient code
(tested with GCC 4.1.2).
09/07/2007: wsfulton
Fix %ignore on constructors which are not explicitly declared [SF #1777712]

View file

@ -32,7 +32,7 @@ namespace std {
%typemap(in) string {
convert_to_string_ex($input);
$1 = std::string(Z_STRVAL_PP($input),Z_STRLEN_PP($input));
$1.assign(Z_STRVAL_PP($input),Z_STRLEN_PP($input));
}
%typemap(typecheck,precedence=SWIG_TYPECHECK_STRING) const string& {
@ -41,7 +41,7 @@ namespace std {
%typemap(in) const string & (std::string temp) {
convert_to_string_ex($input);
temp = std::string(Z_STRVAL_PP($input),Z_STRLEN_PP($input));
temp.assign(Z_STRVAL_PP($input),Z_STRLEN_PP($input));
$1 = &temp;
}