mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-02 10:00:54 +00:00
no need to copy JSString values into String values.
This commit is contained in:
parent
ed536def44
commit
661e422910
@ -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());
|
||||
|
@ -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());
|
||||
|
Loading…
Reference in New Issue
Block a user