Use slice::copy_within in read_certificate

This commit is contained in:
Jack Grigg
2019-11-28 17:14:36 +00:00
parent 48d0a2ab04
commit afb6a9479e
+1 -5
View File
@@ -40,7 +40,6 @@ use crate::{
Buffer,
};
use log::error;
use std::ptr;
use zeroize::Zeroizing;
/// Certificates
@@ -124,10 +123,7 @@ pub(crate) fn read_certificate(txn: &Transaction<'_>, slot: SlotId) -> Result<Bu
return Ok(Zeroizing::new(vec![]));
}
unsafe {
ptr::copy(buf.as_ptr().add(offset), buf.as_mut_ptr(), len);
}
buf.copy_within(offset..offset + len, 0);
buf.truncate(len);
}