fix(napi): remove useless napi_adjust_external_memory in create_external_*_buffer
This commit is contained in:
parent
91e21ce3a0
commit
c4d3876250
1 changed files with 1 additions and 13 deletions
|
@ -297,10 +297,6 @@ impl Env {
|
||||||
&mut raw_value,
|
&mut raw_value,
|
||||||
)
|
)
|
||||||
})?;
|
})?;
|
||||||
let mut changed = 0;
|
|
||||||
check_status!(unsafe {
|
|
||||||
sys::napi_adjust_external_memory(self.0, length as i64, &mut changed)
|
|
||||||
})?;
|
|
||||||
Ok(JsBufferValue::new(
|
Ok(JsBufferValue::new(
|
||||||
JsBuffer(Value {
|
JsBuffer(Value {
|
||||||
env: self.0,
|
env: self.0,
|
||||||
|
@ -416,10 +412,6 @@ impl Env {
|
||||||
&mut raw_value,
|
&mut raw_value,
|
||||||
)
|
)
|
||||||
})?;
|
})?;
|
||||||
let mut changed = 0;
|
|
||||||
check_status!(unsafe {
|
|
||||||
sys::napi_adjust_external_memory(self.0, length as i64, &mut changed)
|
|
||||||
})?;
|
|
||||||
|
|
||||||
Ok(JsArrayBufferValue::new(
|
Ok(JsArrayBufferValue::new(
|
||||||
JsArrayBuffer(Value {
|
JsArrayBuffer(Value {
|
||||||
|
@ -1024,17 +1016,13 @@ impl Env {
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe extern "C" fn drop_buffer(
|
unsafe extern "C" fn drop_buffer(
|
||||||
env: sys::napi_env,
|
_env: sys::napi_env,
|
||||||
finalize_data: *mut c_void,
|
finalize_data: *mut c_void,
|
||||||
hint: *mut c_void,
|
hint: *mut c_void,
|
||||||
) {
|
) {
|
||||||
let length_ptr = hint as *mut (usize, usize);
|
let length_ptr = hint as *mut (usize, usize);
|
||||||
let (length, cap) = *Box::from_raw(length_ptr);
|
let (length, cap) = *Box::from_raw(length_ptr);
|
||||||
mem::drop(Vec::from_raw_parts(finalize_data as *mut u8, length, cap));
|
mem::drop(Vec::from_raw_parts(finalize_data as *mut u8, length, cap));
|
||||||
let mut changed = 0;
|
|
||||||
let adjust_external_memory_status =
|
|
||||||
sys::napi_adjust_external_memory(env, -(length as i64), &mut changed);
|
|
||||||
debug_assert!(Status::from(adjust_external_memory_status) == Status::Ok);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe extern "C" fn raw_finalize<T>(
|
unsafe extern "C" fn raw_finalize<T>(
|
||||||
|
|
Loading…
Reference in a new issue