diff --git a/Cargo.toml b/Cargo.toml index e70f7a0..8e4133a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,3 +1,5 @@ +cargo-features = ["profile-rustflags"] + [package] name = "shush" version = "0.1.0" diff --git a/src/lib.rs b/src/lib.rs index 69fa8c9..01d6c89 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -44,11 +44,13 @@ impl Drop for SecretBox { #[cfg(unix)] { - let page_size = unsafe { sysconf(_SC_PAGESIZE) } as usize; + let page_size = unsafe { sysconf(_SC_PAGESIZE) }; if page_size == -1 { panic!("Error getting page size: \n{}", errno()) } + + let page_size = page_size as usize; // Align the address and size to the page boundary let start = (secret_ptr as usize) & !(page_size - 1); let end = ((secret_ptr as usize) + len + page_size - 1) & !(page_size - 1); @@ -94,11 +96,13 @@ impl SecretBox { #[cfg(unix)] { - let page_size = unsafe { sysconf(_SC_PAGESIZE) } as usize; + let page_size = unsafe { sysconf(_SC_PAGESIZE) }; if page_size == -1 { panic!("Error getting page size: \n{}", errno()) } + let page_size = page_size as usize; + // Align the address and size to the page boundary let start = (secret_ptr as usize) & !(page_size - 1); let end = ((secret_ptr as usize) + len + page_size - 1) & !(page_size - 1);