Another place which can use std::string::assign() which I failed to check in

with the others.  Also use std::string::data() instead of std::string::c_str()
where we don't need the trailing '\0'.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9988 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Olly Betts 2007-10-15 01:40:52 +00:00
commit b1b889059d

View file

@ -38,7 +38,7 @@
#include <string>
Tcl_Obj* SwigString_FromString(std::string s) {
return Tcl_NewStringObj(s.c_str(), s.length());
return Tcl_NewStringObj(s.data(), s.length());
}
int Tcl_GetBoolFromObj(Tcl_Interp *interp, Tcl_Obj *o, bool *val) {
@ -53,9 +53,9 @@ int Tcl_GetBoolFromObj(Tcl_Interp *interp, Tcl_Obj *o, bool *val) {
int SwigString_AsString(Tcl_Interp *interp, Tcl_Obj *o, std::string *val) {
int len;
const char* temp = Tcl_GetStringFromObj(o, &len);
if(temp == NULL)
if (temp == NULL)
return TCL_ERROR;
*val = temp;
val->assign(temp, len);
return TCL_OK;
}