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

Unified Diff: src/libplatform/tracing/trace-object.cc

Issue 2232683002: [Tracing] Minor bugs fix. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: remove end Created 4 years, 4 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 | « no previous file | src/libplatform/tracing/trace-writer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/libplatform/tracing/trace-object.cc
diff --git a/src/libplatform/tracing/trace-object.cc b/src/libplatform/tracing/trace-object.cc
index f8ad9f9f7d49a5ea0851513dad0d2453ccc6fba0..55be8921cb66d46669561ca233f68862bdcdfb2d 100644
--- a/src/libplatform/tracing/trace-object.cc
+++ b/src/libplatform/tracing/trace-object.cc
@@ -21,12 +21,12 @@ V8_INLINE static size_t GetAllocLength(const char* str) {
// Copies |*member| into |*buffer|, sets |*member| to point to this new
// location, and then advances |*buffer| by the amount written.
V8_INLINE static void CopyTraceObjectParameter(char** buffer,
- const char** member,
- const char* end) {
+ const char** member) {
if (*member) {
- strncpy(*buffer, *member, end - *buffer);
+ size_t length = strlen(*member) + 1;
+ strncpy(*buffer, *member, length);
*member = *buffer;
- *buffer += strlen(*member) + 1;
+ *buffer += length;
}
}
@@ -81,17 +81,16 @@ void TraceObject::Initialize(char phase, const uint8_t* category_enabled_flag,
// to free old memory.
delete[] parameter_copy_storage_;
char* ptr = parameter_copy_storage_ = new char[alloc_size];
- const char* end = ptr + alloc_size;
if (copy) {
- CopyTraceObjectParameter(&ptr, &name_, end);
- CopyTraceObjectParameter(&ptr, &scope_, end);
+ CopyTraceObjectParameter(&ptr, &name_);
+ CopyTraceObjectParameter(&ptr, &scope_);
for (int i = 0; i < num_args_; ++i) {
- CopyTraceObjectParameter(&ptr, &arg_names_[i], end);
+ CopyTraceObjectParameter(&ptr, &arg_names_[i]);
}
}
for (int i = 0; i < num_args_; ++i) {
if (arg_is_copy[i]) {
- CopyTraceObjectParameter(&ptr, &arg_values_[i].as_string, end);
+ CopyTraceObjectParameter(&ptr, &arg_values_[i].as_string);
}
}
}
« no previous file with comments | « no previous file | src/libplatform/tracing/trace-writer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698