From 1e17828cb28939c4ee3e4045f9fb86f182059e14 Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Thu, 21 Feb 2019 15:56:03 +0100 Subject: [PATCH] fixup! src: add allocation utils to env --- src/env-inl.h | 3 +-- src/env.h | 2 ++ 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/env-inl.h b/src/env-inl.h index 267567d80cdfaa..63b71daf15a245 100644 --- a/src/env-inl.h +++ b/src/env-inl.h @@ -743,8 +743,7 @@ inline AllocatedBuffer::AllocatedBuffer(Environment* env, uv_buf_t buf) inline void AllocatedBuffer::Resize(size_t len) { char* new_data = env_->Reallocate(buffer_.base, buffer_.len, len); CHECK_IMPLIES(len > 0, new_data != nullptr); - buffer_.base = new_data; - buffer_.len = len; + buffer_ = uv_buf_init(new_data, len); } inline uv_buf_t AllocatedBuffer::release() { diff --git a/src/env.h b/src/env.h index b2e4b2bc7e4079..3856f5241d63b6 100644 --- a/src/env.h +++ b/src/env.h @@ -501,6 +501,8 @@ struct AllocatedBuffer { private: Environment* env_; + // We do not pass this to libuv directly, but uv_buf_t is a convenient way + // to represent a chunk of memory, and plays nicely with other parts of core. uv_buf_t buffer_; friend class Environment;