Skip to content

Commit 1e17828

Browse files
committed
fixup! src: add allocation utils to env
1 parent 41e81b1 commit 1e17828

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/env-inl.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -743,8 +743,7 @@ inline AllocatedBuffer::AllocatedBuffer(Environment* env, uv_buf_t buf)
743743
inline void AllocatedBuffer::Resize(size_t len) {
744744
char* new_data = env_->Reallocate(buffer_.base, buffer_.len, len);
745745
CHECK_IMPLIES(len > 0, new_data != nullptr);
746-
buffer_.base = new_data;
747-
buffer_.len = len;
746+
buffer_ = uv_buf_init(new_data, len);
748747
}
749748

750749
inline uv_buf_t AllocatedBuffer::release() {

src/env.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -501,6 +501,8 @@ struct AllocatedBuffer {
501501

502502
private:
503503
Environment* env_;
504+
// We do not pass this to libuv directly, but uv_buf_t is a convenient way
505+
// to represent a chunk of memory, and plays nicely with other parts of core.
504506
uv_buf_t buffer_;
505507

506508
friend class Environment;

0 commit comments

Comments
 (0)