Skip to content

Commit

Permalink
Merge pull request #1 from EmbarkStudios/update-winapi
Browse files Browse the repository at this point in the history
Update to winapi 0.3.8 which is way, way faster to build.
  • Loading branch information
Elzair authored Dec 19, 2019
2 parents 923add9 + 8fb6f33 commit cd324e7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
5 changes: 2 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,10 @@ appveyor = { repository = "Elzair/page_size_rs" }
no_std = ["spin"]

[dependencies]
spin = { version = "^0.4.5", optional = true }
spin = { version = "0.5.2", optional = true }

[target.'cfg(unix)'.dependencies]
libc = "0.2"

[target.'cfg(windows)'.dependencies]
winapi = "0.2"
kernel32-sys = "0.2"
winapi = { version = "0.3.8", features = ["sysinfoapi"] }
14 changes: 6 additions & 8 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,13 @@ use spin::Once;
#[cfg(not(feature = "no_std"))]
extern crate std;
#[cfg(not(feature = "no_std"))]
use std::sync::{Once, ONCE_INIT};
use std::sync::Once;

#[cfg(unix)]
extern crate libc;

#[cfg(windows)]
extern crate winapi;
#[cfg(target_os = "windows")]
extern crate kernel32;

/// This function retrieves the system's memory page size.
///
Expand Down Expand Up @@ -80,7 +78,7 @@ fn get_helper() -> usize {
#[cfg(all(unix, not(feature = "no_std")))]
#[inline]
fn get_helper() -> usize {
static INIT: Once = ONCE_INIT;
static INIT: Once = Once::new();
static mut PAGE_SIZE: usize = 0;

unsafe {
Expand Down Expand Up @@ -122,7 +120,7 @@ fn get_helper() -> usize {
#[cfg(all(windows, not(feature = "no_std")))]
#[inline]
fn get_helper() -> usize {
static INIT: Once = ONCE_INIT;
static INIT: Once = Once::new();
static mut PAGE_SIZE: usize = 0;

unsafe {
Expand All @@ -142,7 +140,7 @@ fn get_granularity_helper() -> usize {
#[cfg(all(windows, not(feature = "no_std")))]
#[inline]
fn get_granularity_helper() -> usize {
static GRINIT: Once = ONCE_INIT;
static GRINIT: Once = Once::new();
static mut GRANULARITY: usize = 0;

unsafe {
Expand All @@ -158,8 +156,8 @@ mod windows {
#[cfg(not(feature = "no_std"))]
use std::mem;

use winapi::sysinfoapi::{SYSTEM_INFO, LPSYSTEM_INFO};
use kernel32::GetSystemInfo;
use winapi::um::sysinfoapi::{SYSTEM_INFO, LPSYSTEM_INFO};
use winapi::um::sysinfoapi::GetSystemInfo;

#[inline]
pub fn get() -> usize {
Expand Down

0 comments on commit cd324e7

Please sign in to comment.