no need to copy JSString values into String values.

This commit is contained in:
beard%netscape.com 2000-12-30 07:06:03 +00:00
parent ed536def44
commit 661e422910
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());

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());