diff options
author | Olly Betts <olly@survex.com> | 2007-10-15 01:40:52 +0000 |
---|---|---|
committer | Olly Betts <olly@survex.com> | 2007-10-15 01:40:52 +0000 |
commit | b1b889059d2ca9ef5c9a248e3805277719e41351 (patch) | |
tree | e610cc5f05ac17b4779ea61f44a558c5c8fc0186 /Lib | |
parent | 32acb4c43e6e77f1d8a54794ef4b06c73c14eaf3 (diff) | |
download | swig-b1b889059d2ca9ef5c9a248e3805277719e41351.tar.gz |
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
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/tcl/std_vector.i | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Lib/tcl/std_vector.i b/Lib/tcl/std_vector.i index fcb394c2c..700547fe9 100644 --- a/Lib/tcl/std_vector.i +++ b/Lib/tcl/std_vector.i @@ -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; } |