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

replace unmaintained safemem with std alternatives #3

Merged
merged 1 commit into from
Mar 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ readme = "README.md"
edition = "2021"

[dependencies]
safemem = "0.3"
memchr = "2.0"

# `slice_deque` is only supported on platforms with virtual memory
Expand Down
3 changes: 2 additions & 1 deletion src/buffer/std_buf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ impl StdBuf {
// simply move the bytes down to the beginning
let len = self.len();

safemem::copy_over(unsafe { self.buf.as_mut_slice() }, self.pos, 0, len);
let buf_slice = unsafe { self.buf.as_mut_slice() };
buf_slice.copy_within(self.pos..self.pos+len, 0);

self.pos = 0;
self.end = len;
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1037,7 +1037,7 @@ impl Buffer {
if self.zeroed < cap {
unsafe {
let buf = self.buf.write_buf();
safemem::write_bytes(buf, 0);
buf.fill(0);
}

self.zeroed = cap;
Expand Down
Loading