diff options
author | Keyhan Vakil <kvakil@sylph.kvakil.me> | 2022-08-03 09:45:45 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-03 09:45:45 +0300 |
commit | 8c35a4e4e63d5c384b9ff5a4e9afdc903d242f72 (patch) | |
tree | dfda48b58f93ad161e66a3f77f054b2ecae341ad /src/util.h | |
parent | 4dedd81c1bd2ef1afb1183d515ca74b427349779 (diff) |
src: remove unowned usages of GetBackingStore
This removes all usages of GetBackingStore without any entries in the
`CODEOWNERS` file. For the most part this is a pretty straightforward
review; except `SPREAD_BUFFER_ARG` and the changes to `CopyArrayBuffer`.
See the linked issue for an explanation.
Refs: https://github.com/nodejs/node/issues/32226
Refs: https://github.com/nodejs/node/pull/43921
PR-URL: https://github.com/nodejs/node/pull/44080
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Diffstat (limited to 'src/util.h')
-rw-r--r-- | src/util.h | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/src/util.h b/src/util.h index ea3ccb364bd..290862e21c1 100644 --- a/src/util.h +++ b/src/util.h @@ -535,17 +535,14 @@ class BufferValue : public MaybeStackBuffer<char> { inline std::string ToString() const { return std::string(out(), length()); } }; -#define SPREAD_BUFFER_ARG(val, name) \ - CHECK((val)->IsArrayBufferView()); \ - v8::Local<v8::ArrayBufferView> name = (val).As<v8::ArrayBufferView>(); \ - std::shared_ptr<v8::BackingStore> name##_bs = \ - name->Buffer()->GetBackingStore(); \ - const size_t name##_offset = name->ByteOffset(); \ - const size_t name##_length = name->ByteLength(); \ - char* const name##_data = \ - static_cast<char*>(name##_bs->Data()) + name##_offset; \ - if (name##_length > 0) \ - CHECK_NE(name##_data, nullptr); +#define SPREAD_BUFFER_ARG(val, name) \ + CHECK((val)->IsArrayBufferView()); \ + v8::Local<v8::ArrayBufferView> name = (val).As<v8::ArrayBufferView>(); \ + const size_t name##_offset = name->ByteOffset(); \ + const size_t name##_length = name->ByteLength(); \ + char* const name##_data = \ + static_cast<char*>(name->Buffer()->Data()) + name##_offset; \ + if (name##_length > 0) CHECK_NE(name##_data, nullptr); // Use this when a variable or parameter is unused in order to explicitly // silence a compiler warning about that. |