Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1628)

Unified Diff: src/utils.cc

Issue 6529055: [Isolates] Merge crankshaft (r5922 from bleeding_edge). (Closed)
Patch Set: Win32 port Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/utils.h ('k') | src/v8.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/utils.cc
diff --git a/src/utils.cc b/src/utils.cc
index 7096ba35ab26ea37f9d758050a5ea904fb084440..2c234bb76225ced2e5012c16fe8935d589188ba5 100644
--- a/src/utils.cc
+++ b/src/utils.cc
@@ -168,6 +168,23 @@ int WriteCharsToFile(const char* str, int size, FILE* f) {
}
+int AppendChars(const char* filename,
+ const char* str,
+ int size,
+ bool verbose) {
+ FILE* f = OS::FOpen(filename, "ab");
+ if (f == NULL) {
+ if (verbose) {
+ OS::PrintError("Cannot open file %s for writing.\n", filename);
+ }
+ return 0;
+ }
+ int written = WriteCharsToFile(str, size, f);
+ fclose(f);
+ return written;
+}
+
+
int WriteChars(const char* filename,
const char* str,
int size,
@@ -214,11 +231,16 @@ void StringBuilder::AddSubstring(const char* s, int n) {
void StringBuilder::AddFormatted(const char* format, ...) {
+ va_list arguments;
+ va_start(arguments, format);
+ AddFormattedList(format, arguments);
+ va_end(arguments);
+}
+
+
+void StringBuilder::AddFormattedList(const char* format, va_list list) {
ASSERT(!is_finalized() && position_ < buffer_.length());
- va_list args;
- va_start(args, format);
- int n = OS::VSNPrintF(buffer_ + position_, format, args);
- va_end(args);
+ int n = OS::VSNPrintF(buffer_ + position_, format, list);
if (n < 0 || n >= (buffer_.length() - position_)) {
position_ = buffer_.length();
} else {
« no previous file with comments | « src/utils.h ('k') | src/v8.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698