-
Notifications
You must be signed in to change notification settings - Fork 533
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
refactor: more consistent C binding pattern #5162
Conversation
57b170f
to
452ab64
Compare
Signed-off-by: tison <wander4096@gmail.com>
452ab64
to
c1de660
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
bindings/c/src/writer.rs
Outdated
@@ -70,7 +72,7 @@ impl opendal_writer { | |||
#[no_mangle] | |||
pub unsafe extern "C" fn opendal_writer_free(ptr: *mut opendal_writer) { | |||
if !ptr.is_null() { | |||
let _ = (&*ptr).deref_mut().close(); | |||
let _ = (*ptr).deref_mut().close(); | |||
let _ = unsafe { Box::from_raw((*ptr).inner as *mut core::BlockingWriter) }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we drop too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes of course
bindings/c/src/writer.rs
Outdated
@@ -70,7 +72,7 @@ impl opendal_writer { | |||
#[no_mangle] | |||
pub unsafe extern "C" fn opendal_writer_free(ptr: *mut opendal_writer) { | |||
if !ptr.is_null() { | |||
let _ = (&*ptr).deref_mut().close(); | |||
let _ = (*ptr).deref_mut().close(); | |||
let _ = unsafe { Box::from_raw((*ptr).inner as *mut core::BlockingWriter) }; | |||
let _ = unsafe { Box::from_raw(ptr) }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The same
Signed-off-by: tison <wander4096@gmail.com>
Signed-off-by: tison <wander4096@gmail.com>
This reverts commit deccb8b.
This follows #5160