1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-29 10:39:10 -05:00

core: make PinnedBuf::Raw -> PinnedBuf conversion actually a move

This commit is contained in:
Bert Belder 2019-05-11 03:13:29 +02:00
parent 1fc61f3b6a
commit 369a7ec94e
No known key found for this signature in database
GPG key ID: 7A77887B2E2ED461
2 changed files with 6 additions and 6 deletions

View file

@ -167,7 +167,7 @@ void deno_execute(Deno* d_, void* user_data, const char* js_filename,
void deno_pinned_buf_delete(deno_pinned_buf* buf) { void deno_pinned_buf_delete(deno_pinned_buf* buf) {
// The PinnedBuf destructor implicitly releases the ArrayBuffer reference. // The PinnedBuf destructor implicitly releases the ArrayBuffer reference.
auto _ = deno::PinnedBuf(*buf); auto _ = deno::PinnedBuf(buf);
} }
void deno_respond(Deno* d_, void* user_data, deno_buf buf) { void deno_respond(Deno* d_, void* user_data, deno_buf buf) {

View file

@ -114,11 +114,11 @@ class PinnedBuf {
// This constructor recreates a PinnedBuf that has previously been converted // This constructor recreates a PinnedBuf that has previously been converted
// to a PinnedBuf::Raw using the IntoRaw() method. This is a move operation; // to a PinnedBuf::Raw using the IntoRaw() method. This is a move operation;
// the Raw struct is emptied in the process. // the Raw struct is emptied in the process.
explicit PinnedBuf(Raw raw) explicit PinnedBuf(Raw* raw)
: data_ptr_(raw.data_ptr), data_len_(raw.data_len), pin_(raw.pin) { : data_ptr_(raw->data_ptr), data_len_(raw->data_len), pin_(raw->pin) {
raw.data_ptr = nullptr; raw->data_ptr = nullptr;
raw.data_len = 0; raw->data_len = 0;
raw.pin = nullptr; raw->pin = nullptr;
} }
// The IntoRaw() method converts the PinnedBuf to a PinnedBuf::Raw so it's // The IntoRaw() method converts the PinnedBuf to a PinnedBuf::Raw so it's