Commit 69afd18e authored by keuchel@chromium.org's avatar keuchel@chromium.org

Use OS::SNPrintF instead of snprintf.

Review URL: http://codereview.chromium.org/8339011

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@9674 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 4e5643a6
...@@ -746,7 +746,7 @@ TEST(RegExpScanning) { ...@@ -746,7 +746,7 @@ TEST(RegExpScanning) {
} }
TEST(ScopePositiosn) { TEST(ScopePositions) {
// Test the parser for correctly setting the start and end positions // Test the parser for correctly setting the start and end positions
// of a scope. We check the scope positions of exactly one scope // of a scope. We check the scope positions of exactly one scope
// nested in the global scope of a program. 'inner source' is the // nested in the global scope of a program. 'inner source' is the
...@@ -843,21 +843,23 @@ TEST(ScopePositiosn) { ...@@ -843,21 +843,23 @@ TEST(ScopePositiosn) {
size_t kInnerLen = strlen(source_data[i].inner_source); size_t kInnerLen = strlen(source_data[i].inner_source);
size_t kSuffixLen = strlen(source_data[i].outer_suffix); size_t kSuffixLen = strlen(source_data[i].outer_suffix);
size_t kProgramSize = kPrefixLen + kInnerLen + kSuffixLen; size_t kProgramSize = kPrefixLen + kInnerLen + kSuffixLen;
i::SmartArrayPointer<char> program( i::Vector<char> program = i::Vector<char>::New(kProgramSize + 1);
reinterpret_cast<char*>(malloc(kProgramSize + 1))); size_t length;
snprintf(*program, kProgramSize + 1, "%s%s%s", length = i::OS::SNPrintF(program, "%s%s%s",
source_data[i].outer_prefix, source_data[i].outer_prefix,
source_data[i].inner_source, source_data[i].inner_source,
source_data[i].outer_suffix); source_data[i].outer_suffix);
ASSERT(length == kProgramSize);
// Parse program source. // Parse program source.
i::Handle<i::String> source( i::Handle<i::String> source(
FACTORY->NewStringFromAscii(i::CStrVector(*program))); FACTORY->NewStringFromAscii(i::CStrVector(program.start())));
i::Handle<i::Script> script = FACTORY->NewScript(source); i::Handle<i::Script> script = FACTORY->NewScript(source);
i::Parser parser(script, false, NULL, NULL); i::Parser parser(script, false, NULL, NULL);
parser.SetHarmonyScoping(true); parser.SetHarmonyScoping(true);
i::FunctionLiteral* function = i::FunctionLiteral* function =
parser.ParseProgram(source, true, i::kNonStrictMode); parser.ParseProgram(source, true, i::kNonStrictMode);
ASSERT(function != NULL);
// Check scope types and positions. // Check scope types and positions.
i::Scope* scope = function->scope(); i::Scope* scope = function->scope();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment