Skip to content

Commit

Permalink
Conditionally define macro that's only used in Linux builds.
Browse files Browse the repository at this point in the history
  • Loading branch information
jdm committed May 29, 2017
1 parent 74ff7f9 commit be98fef
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions components/profile/mem.rs
Expand Up @@ -505,11 +505,6 @@ mod system_reporter {
None
}

// Like std::macros::try!, but for Option<>.
macro_rules! option_try(
($e:expr) => (match $e { Some(e) => e, None => return None })
);

#[cfg(target_os = "linux")]
fn page_size() -> usize {
unsafe {
Expand All @@ -522,6 +517,11 @@ mod system_reporter {
use std::fs::File;
use std::io::Read;

// Like std::macros::try!, but for Option<>.
macro_rules! option_try(
($e:expr) => (match $e { Some(e) => e, None => return None })
);

let mut f = option_try!(File::open("/proc/self/statm").ok());
let mut contents = String::new();
option_try!(f.read_to_string(&mut contents).ok());
Expand Down

0 comments on commit be98fef

Please sign in to comment.