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

Unified Diff: mojo/public/cpp/bindings/lib/scratch_buffer.cc

Issue 262093011: Revert of Make sure that ScratchBuffer::Allocate() always return 8-byte aligned address. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 | « no previous file | mojo/public/cpp/bindings/tests/buffer_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/cpp/bindings/lib/scratch_buffer.cc
diff --git a/mojo/public/cpp/bindings/lib/scratch_buffer.cc b/mojo/public/cpp/bindings/lib/scratch_buffer.cc
index dee048f3a1ac3078fe0f564207e9d68bfe7b9d14..9d23dcb13bba25b7b2dde5d1d5d5fc4f56847ca7 100644
--- a/mojo/public/cpp/bindings/lib/scratch_buffer.cc
+++ b/mojo/public/cpp/bindings/lib/scratch_buffer.cc
@@ -80,12 +80,11 @@
return false;
// Ensure segment buffer is aligned.
- size_t padded_segment_size = internal::Align(sizeof(Segment));
- Segment* segment = static_cast<Segment*>(
- malloc(padded_segment_size + delta));
+ size_t segment_size = internal::Align(sizeof(Segment)) + delta;
+ Segment* segment = static_cast<Segment*>(malloc(segment_size));
if (segment) {
segment->next = overflow_;
- segment->cursor = reinterpret_cast<char*>(segment) + padded_segment_size;
+ segment->cursor = reinterpret_cast<char*>(segment + 1);
segment->end = segment->cursor + delta;
overflow_ = segment;
return true;
« no previous file with comments | « no previous file | mojo/public/cpp/bindings/tests/buffer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698