src: refacor `MallocedBuffer` to it's usage scope
As discussed in https://github.com/nodejs/node/pull/23543#pullrequestreview-164467022.
MallocedBuffer
is an unknown quantity as compared to std::unique_ptr
.
-
MallocedBuffer
is a new utility and is node specific, so it's semantics are not clear to me, so I assume to others as well.- It's maturity is unknown (Ref: #23434)
- It's ambiguous if
MallocedBuffer::size
is in units ofT
or number ofbyte
-
std::unique_ptr
is free of runtime cost (except for its dtor), whileMallocedBuffer
at minimum carries the runtime cost of construction, and the memory cost ofMallocedBuffer::size
. - And probably most important to me - readability.
std::unique_ptr
is standardized and well documented.MallocedBuffer
is only documented by its code. - While refactoring is seems like it has no unit test coverage.
Ref: https://github.com/nodejs/node/pull/23543#pullrequestreview-164467022 Ref: https://github.com/nodejs/node/pull/23434
CI: https://ci.nodejs.org/job/node-test-pull-request/17821
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
commit message follows commit guidelines