no need to copy JSString values into String values.

git-svn-id: svn://10.0.0.236/trunk@84222 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
beard%netscape.com
2000-12-30 07:06:03 +00:00
parent b42f0985d5
commit 8daa6ee2f4
2 changed files with 4 additions and 6 deletions

View File

@@ -157,7 +157,7 @@ static JSValue load(Context *cx, const JSValues &argv)
for (size_t i = 1; i < n; ++i) {
JSValue val = argv[i].toString();
if (val.isString()) {
String fileName(*val.string);
JSString& fileName(*val.string);
std::string str(fileName.length(), char());
std::transform(fileName.begin(), fileName.end(), str.begin(), narrow);
FILE* f = fopen(str.c_str(), "r");
@@ -173,14 +173,13 @@ static JSValue load(Context *cx, const JSValues &argv)
static JSValue loadxml(Context *cx, const JSValues &argv)
{
JSValue result;
size_t n = argv.size();
if (n > 1) {
for (size_t i = 1; i < n; ++i) {
JSValue val = argv[i].toString();
if (val.isString()) {
String fileName(*val.string);
JSString& fileName(*val.string);
std::string str(fileName.length(), char());
std::transform(fileName.begin(), fileName.end(), str.begin(), narrow);
cx->loadClass(str.c_str());