Skip to content

Commit

Permalink
fixup! src: add allocation utils to env
Browse files Browse the repository at this point in the history
  • Loading branch information
addaleax committed Feb 21, 2019
1 parent 41e81b1 commit 1e17828
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 1 addition & 2 deletions src/env-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
2 changes: 2 additions & 0 deletions src/env.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 1e17828

Please sign in to comment.