Index: runtime/vm/datastream.h |
diff --git a/runtime/vm/datastream.h b/runtime/vm/datastream.h |
index 3e9a6c0d7e4b9476c3460b3299167905215af4b0..5a43bd5917c7f469312eb9ccf149f516a991df4b 100644 |
--- a/runtime/vm/datastream.h |
+++ b/runtime/vm/datastream.h |
@@ -388,6 +388,29 @@ class WriteStream : public ValueObject { |
va_list args; |
va_start(args, format); |
VPrint(format, args); |
+ va_end(args); |
+ } |
+ |
+ void VPrint(const char* format, va_list args) { |
+ // Measure. |
+ va_list measure_args; |
+ va_copy(measure_args, args); |
+ intptr_t len = OS::VSNPrint(NULL, 0, format, measure_args); |
+ va_end(measure_args); |
+ |
+ // Alloc. |
+ if ((end_ - current_) < (len + 1)) { |
+ Resize(len + 1); |
+ } |
+ ASSERT((end_ - current_) >= (len + 1)); |
+ |
+ // Print. |
+ va_list print_args; |
+ va_copy(print_args, args); |
+ OS::VSNPrint(reinterpret_cast<char*>(current_), len + 1, format, |
+ print_args); |
+ va_end(print_args); |
+ current_ += len; // Not len + 1 to swallow the terminating NUL. |
} |
template <typename T> |
@@ -428,28 +451,6 @@ class WriteStream : public ValueObject { |
ASSERT(end_ > *buffer_); |
} |
- void VPrint(const char* format, va_list args) { |
- // Measure. |
- va_list measure_args; |
- va_copy(measure_args, args); |
- intptr_t len = OS::VSNPrint(NULL, 0, format, measure_args); |
- va_end(measure_args); |
- |
- // Alloc. |
- if ((end_ - current_) < (len + 1)) { |
- Resize(len + 1); |
- } |
- ASSERT((end_ - current_) >= (len + 1)); |
- |
- // Print. |
- va_list print_args; |
- va_copy(print_args, args); |
- OS::VSNPrint(reinterpret_cast<char*>(current_), len + 1, format, |
- print_args); |
- va_end(print_args); |
- current_ += len; // Not len + 1 to swallow the terminating NUL. |
- } |
- |
private: |
uint8_t** const buffer_; |
uint8_t* end_; |