Skip to content

Commit

Permalink
lib: don't advise sequential access
Browse files Browse the repository at this point in the history
  • Loading branch information
R1kaB3rN committed Dec 14, 2024
1 parent 5bf3d7a commit dc6fd42
Showing 1 changed file with 0 additions and 4 deletions.
4 changes: 0 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ fn bspatch_rs(py: Python<'_>, source: i32, patch: &[u8]) -> io::Result<Vec<u8>>
// Optimization. Let the kernel know the specific ranges we're
// accessing. Here, we only need to access up to the original's
// length
mmap.advise_range(Advice::Sequential, 0, original_size as usize)
.unwrap();
patcher.apply(&mmap[..original_size as usize], &mut target)?;

// Validate target size before writing to mmap
Expand All @@ -58,8 +56,6 @@ fn bspatch_rs(py: Python<'_>, source: i32, patch: &[u8]) -> io::Result<Vec<u8>>
));
}
// Access the entire range, then apply our patched result in-place
mmap.advise_range(Advice::Sequential, 0, target.len())
.unwrap();
mmap[..target.len()].copy_from_slice(&target[..]);

// Handle small file case
Expand Down

0 comments on commit dc6fd42

Please sign in to comment.