Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

capi: Fix 'unused return value' warnings #882

Merged
merged 2 commits into from
Jul 14, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions regex-capi/src/rure.rs
Original file line number Diff line number Diff line change
Expand Up @@ -257,8 +257,8 @@ ffi_fn! {
fn rure_iter_capture_names_free(it: *mut IterCaptureNames) {
unsafe {
let it = &mut *it;
while let Some(ptr) = it.name_ptrs.pop(){
CString::from_raw(ptr);
while let Some(ptr) = it.name_ptrs.pop() {
drop(CString::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.

We might as well go the whole nine yards here and add drop(..) around other calls to from_raw as well. e.g., Box::from_raw. Would you mind doing that as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you for the review comment. I searched Box::from_raw and applied the same fix at 1324f2d

}
Box::from_raw(it);
}
Expand Down Expand Up @@ -624,6 +624,6 @@ fn rure_escape(

ffi_fn! {
fn rure_cstring_free(s: *mut c_char) {
unsafe { CString::from_raw(s); }
unsafe { drop(CString::from_raw(s)); }
}
}