Skip to content

Commit 974ff4a

Browse files
roypatbonzini
authored andcommitted
Implement VolatileMemory::get_slice in terms of subslice
The two functions contain exactly the same body, so just have one call the other. No functional change intended. Signed-off-by: Patrick Roy <roypat@amazon.co.uk>
1 parent 162d82f commit 974ff4a

File tree

1 file changed

+1
-13
lines changed

1 file changed

+1
-13
lines changed

src/volatile_memory.rs

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1019,19 +1019,7 @@ impl<B: BitmapSlice> VolatileMemory for VolatileSlice<'_, B> {
10191019
}
10201020

10211021
fn get_slice(&self, offset: usize, count: usize) -> Result<VolatileSlice<B>> {
1022-
let _ = self.compute_end_offset(offset, count)?;
1023-
Ok(
1024-
// SAFETY: This is safe because the pointer is range-checked by compute_end_offset, and
1025-
// the lifetime is the same as self.
1026-
unsafe {
1027-
VolatileSlice::with_bitmap(
1028-
self.addr.add(offset),
1029-
count,
1030-
self.bitmap.slice_at(offset),
1031-
self.mmap,
1032-
)
1033-
},
1034-
)
1022+
self.subslice(offset, count)
10351023
}
10361024
}
10371025

0 commit comments

Comments
 (0)