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

Unified Diff: runtime/vm/code_observers.cc

Issue 16271010: Use 'new' in all the snapshot reallocation functions instead of realloc. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 6 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/vm/class_table.cc ('k') | runtime/vm/dart_api_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/code_observers.cc
===================================================================
--- runtime/vm/code_observers.cc (revision 23633)
+++ runtime/vm/code_observers.cc (working copy)
@@ -4,6 +4,7 @@
#include "vm/code_observers.h"
+#include "platform/utils.h"
#include "vm/os.h"
namespace dart {
@@ -13,12 +14,12 @@
void CodeObservers::Register(CodeObserver* observer) {
- observers_length_++;
- observers_ = reinterpret_cast<CodeObserver**>(
- realloc(observers_, sizeof(observer) * observers_length_));
+ intptr_t new_length = observers_length_ + 1;
+ observers_ = Utils::Realloc(observers_, observers_length_, new_length);
if (observers_ == NULL) {
FATAL("failed to grow code observers array");
}
+ observers_length_ = new_length;
observers_[observers_length_ - 1] = observer;
}
« no previous file with comments | « runtime/vm/class_table.cc ('k') | runtime/vm/dart_api_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698