mirror of
https://github.com/denoland/deno.git
synced 2025-09-27 20:59:10 +00:00
core: remove support for moving deno_buf ownership from C++ to JavaScript
The functionality hasn't been in use for a long time. Without this feature, the `alloc_ptr` and `alloc_len` fields are no longer necessary.
This commit is contained in:
parent
c05cbc8eac
commit
ae0544b7ce
6 changed files with 40 additions and 144 deletions
|
@ -19,16 +19,9 @@ pub struct isolate {
|
|||
_unused: [u8; 0],
|
||||
}
|
||||
|
||||
/// If "alloc_ptr" is not null, this type represents a buffer which is created
|
||||
/// in C side, and then passed to Rust side by `deno_recv_cb`. Finally it should
|
||||
/// be moved back to C side by `deno_respond`. If it is not passed to
|
||||
/// `deno_respond` in the end, it will be leaked.
|
||||
///
|
||||
/// If "alloc_ptr" is null, this type represents a borrowed slice.
|
||||
/// This type represents a borrowed slice.
|
||||
#[repr(C)]
|
||||
pub struct deno_buf {
|
||||
alloc_ptr: *const u8,
|
||||
alloc_len: usize,
|
||||
data_ptr: *const u8,
|
||||
data_len: usize,
|
||||
}
|
||||
|
@ -41,8 +34,6 @@ impl deno_buf {
|
|||
#[inline]
|
||||
pub fn empty() -> Self {
|
||||
Self {
|
||||
alloc_ptr: null(),
|
||||
alloc_len: 0,
|
||||
data_ptr: null(),
|
||||
data_len: 0,
|
||||
}
|
||||
|
@ -51,8 +42,6 @@ impl deno_buf {
|
|||
#[inline]
|
||||
pub unsafe fn from_raw_parts(ptr: *const u8, len: usize) -> Self {
|
||||
Self {
|
||||
alloc_ptr: null(),
|
||||
alloc_len: 0,
|
||||
data_ptr: ptr,
|
||||
data_len: len,
|
||||
}
|
||||
|
@ -64,8 +53,6 @@ impl<'a> From<&'a [u8]> for deno_buf {
|
|||
#[inline]
|
||||
fn from(x: &'a [u8]) -> Self {
|
||||
Self {
|
||||
alloc_ptr: null(),
|
||||
alloc_len: 0,
|
||||
data_ptr: x.as_ref().as_ptr(),
|
||||
data_len: x.len(),
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue