Skip to content

Commit

Permalink
Cleanup use of mut ptr
Browse files Browse the repository at this point in the history
  • Loading branch information
justsmth committed May 29, 2024
1 parent 0186ef7 commit 4d5e07e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion aws-lc-rs/src/cbb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ impl LcCBB<'static> {
return Err(Unspecified);
};

let out_data = LcPtr::new(out_data)?;
let mut out_data = LcPtr::new(out_data)?;

// TODO: Need a type to just hold the owned pointer from CBB rather then copying
Ok(Buffer::take_from_slice(unsafe {
Expand Down
6 changes: 3 additions & 3 deletions aws-lc-rs/src/ptr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ impl<P: Pointer> ManagedPointer<P> {
}

#[allow(clippy::mut_from_ref)]
pub unsafe fn as_slice_mut(&self, len: usize) -> &mut [P::T] {
pub unsafe fn as_slice_mut(&mut self, len: usize) -> &mut [P::T] {
core::slice::from_raw_parts_mut(self.pointer.as_mut_ptr(), len)
}
}
Expand Down Expand Up @@ -150,7 +150,7 @@ pub(crate) trait Pointer {

fn free(&mut self);
fn as_const_ptr(&self) -> *const Self::T;
fn as_mut_ptr(&self) -> *mut Self::T;
fn as_mut_ptr(&mut self) -> *mut Self::T;
}

pub(crate) trait IntoPointer<P> {
Expand Down Expand Up @@ -187,7 +187,7 @@ macro_rules! create_pointer {
}

#[inline]
fn as_mut_ptr(&self) -> *mut Self::T {
fn as_mut_ptr(&mut self) -> *mut Self::T {
*self
}
}
Expand Down

0 comments on commit 4d5e07e

Please sign in to comment.