mirror of
https://github.com/chatmail/core.git
synced 2026-10-02 11:10:25 +03:00
refactor: reduce the scope of unsafe in dc_context_unref()
This commit is contained in:
@@ -194,13 +194,11 @@ pub unsafe extern "C" fn dc_context_is_open(context: *mut dc_context_t) -> libc:
|
|||||||
/// This function releases the memory of the `dc_context_t` structure.
|
/// This function releases the memory of the `dc_context_t` structure.
|
||||||
#[unsafe(no_mangle)]
|
#[unsafe(no_mangle)]
|
||||||
pub unsafe extern "C" fn dc_context_unref(context: *mut dc_context_t) {
|
pub unsafe extern "C" fn dc_context_unref(context: *mut dc_context_t) {
|
||||||
unsafe {
|
|
||||||
if context.is_null() {
|
if context.is_null() {
|
||||||
eprintln!("ignoring careless call to dc_context_unref()");
|
eprintln!("ignoring careless call to dc_context_unref()");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
drop(Box::from_raw(context));
|
drop(unsafe { Box::from_raw(context) });
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[unsafe(no_mangle)]
|
#[unsafe(no_mangle)]
|
||||||
|
|||||||
Reference in New Issue
Block a user