mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2025-01-01 23:08:42 +00:00
Use Box::from/into_raw()
This commit is contained in:
parent
6a3a42717f
commit
833148cef6
1 changed files with 3 additions and 8 deletions
|
@ -1,17 +1,12 @@
|
|||
use std::mem;
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn filesrc_new() -> *mut FileSrc {
|
||||
let mut instance = Box::new(FileSrc::new());
|
||||
return &mut *instance;
|
||||
let instance = Box::new(FileSrc::new());
|
||||
return Box::into_raw(instance);
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn filesrc_drop(ptr: *mut FileSrc) {
|
||||
let filesrc: &mut FileSrc = unsafe { &mut *ptr };
|
||||
|
||||
println!("drop");
|
||||
drop(filesrc);
|
||||
unsafe { Box::from_raw(ptr) };
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
|
|
Loading…
Reference in a new issue