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

Unified Diff: runtime/platform/json.cc

Issue 10383122: Eliminate need for va_copy in json.cc (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 7 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 | « runtime/platform/json.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/platform/json.cc
===================================================================
--- runtime/platform/json.cc (revision 7522)
+++ runtime/platform/json.cc (working copy)
@@ -11,11 +11,6 @@
namespace dart {
-#ifndef va_copy
-#define va_copy(dst, src) (memmove(&(dst), &(src), sizeof(dst)))
-#endif /* va_copy */
-
-
JSONScanner::JSONScanner(const char* json_text) {
SetText(json_text);
}
@@ -354,20 +349,20 @@
}
-intptr_t TextBuffer::Printf(const char* format, va_list args) {
- va_list args1;
- va_copy(args1, args);
+intptr_t TextBuffer::Printf(const char* format, ...) {
+ va_list args;
+ va_start(args, format);
intptr_t remaining = buf_size_ - msg_len_;
ASSERT(remaining >= 0);
- intptr_t len = OS::VSNPrint(buf_ + msg_len_, remaining, format, args1);
- va_end(args1);
+ intptr_t len = OS::VSNPrint(buf_ + msg_len_, remaining, format, args);
+ va_end(args);
if (len >= remaining) {
const int kBufferSpareCapacity = 64; // Somewhat arbitrary.
GrowBuffer(len + kBufferSpareCapacity);
remaining = buf_size_ - msg_len_;
ASSERT(remaining > len);
va_list args2;
- va_copy(args2, args);
+ va_start(args2, format);
intptr_t len2 = OS::VSNPrint(buf_ + msg_len_, remaining, format, args2);
va_end(args2);
ASSERT(len == len2);
@@ -378,15 +373,6 @@
}
-intptr_t TextBuffer::Printf(const char* format, ...) {
- va_list args;
- va_start(args, format);
- intptr_t len = this->Printf(format, args);
- va_end(args);
- return len;
-}
-
-
void TextBuffer::GrowBuffer(intptr_t len) {
intptr_t new_size = buf_size_ + len;
char* new_buf = reinterpret_cast<char*>(realloc(buf_, new_size));
« no previous file with comments | « runtime/platform/json.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698