From 08cdb5a7eeae460f52859ea0186ec309454b8e2e Mon Sep 17 00:00:00 2001 From: Olly Betts Date: Tue, 25 May 2010 21:46:23 +0000 Subject: [PATCH] Set string contents when we allocate it for a small efficiency gain. git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12052 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Lib/php/std_string.i | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Lib/php/std_string.i b/Lib/php/std_string.i index 656765194..f6b036bd8 100644 --- a/Lib/php/std_string.i +++ b/Lib/php/std_string.i @@ -71,8 +71,7 @@ namespace std { %typemap(directorout) string & (std::string *temp) %{ convert_to_string_ex($input); - temp = new std::string; - temp->assign(Z_STRVAL_PP($input), Z_STRLEN_PP($input)); + temp = new std::string(Z_STRVAL_PP($input), Z_STRLEN_PP($input)); swig_acquire_ownership(temp); $result = temp; %}