Skip to content
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

Merged
merged 4 commits into from
Oct 6, 2024
Merged

refactor: more consistent C binding pattern #5162

merged 4 commits into from
Oct 6, 2024

Conversation

tisonkun
Copy link
Member

@tisonkun tisonkun commented Oct 5, 2024

This follows #5160

Signed-off-by: tison <wander4096@gmail.com>
Copy link
Member

@suyanhanx suyanhanx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@@ -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) };
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we drop too?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes of course

@@ -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) };
Copy link
Member

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>
@tisonkun tisonkun merged commit d74bf7c into main Oct 6, 2024
33 checks passed
@tisonkun tisonkun deleted the cbingen-inners branch October 6, 2024 08:58
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants