From d108a22fd1b38c108e2b9b6cd7276d953524ffa2 Mon Sep 17 00:00:00 2001 From: Kevin Ballard Date: Wed, 16 Oct 2013 09:55:55 -0700 Subject: [PATCH] path2: Update for privacy changes Remove redundant `contains_nul` definition. Make `parse_prefix` private. --- src/libstd/path/posix.rs | 6 ------ src/libstd/path/windows.rs | 12 +++--------- 2 files changed, 3 insertions(+), 15 deletions(-) diff --git a/src/libstd/path/posix.rs b/src/libstd/path/posix.rs index 271937dfcf2..87821105d37 100644 --- a/src/libstd/path/posix.rs +++ b/src/libstd/path/posix.rs @@ -439,12 +439,6 @@ fn normalize_helper<'a>(v: &'a [u8], is_abs: bool) -> Option<~[&'a [u8]]> { } } -// FIXME (#8169): Pull this into parent module once visibility works -#[inline(always)] -fn contains_nul(v: &[u8]) -> bool { - v.iter().any(|&x| x == 0) -} - static dot_static: &'static [u8] = bytes!("."); static dot_dot_static: &'static [u8] = bytes!(".."); diff --git a/src/libstd/path/windows.rs b/src/libstd/path/windows.rs index 0ee0d9c79d1..0de2bd4c742 100644 --- a/src/libstd/path/windows.rs +++ b/src/libstd/path/windows.rs @@ -21,7 +21,7 @@ use str; use str::{CharSplitIterator, OwnedStr, Str, StrVector}; use to_bytes::IterBytes; use vec::Vector; -use super::{BytesContainer, GenericPath, GenericPathUnsafe}; +use super::{contains_nul, BytesContainer, GenericPath, GenericPathUnsafe}; #[cfg(target_os = "win32")] use libc; @@ -922,9 +922,8 @@ pub enum PathPrefix { DiskPrefix } -/// Internal function; only public for tests. Don't use. // FIXME (#8169): Make private once visibility is fixed -pub fn parse_prefix<'a>(mut path: &'a str) -> Option { +fn parse_prefix<'a>(mut path: &'a str) -> Option { if path.starts_with("\\\\") { // \\ path = path.slice_from(2); @@ -1032,12 +1031,6 @@ fn normalize_helper<'a>(s: &'a str, prefix: Option) -> (bool,Option< } } -// FIXME (#8169): Pull this into parent module once visibility works -#[inline(always)] -fn contains_nul(v: &[u8]) -> bool { - v.iter().any(|&x| x == 0) -} - fn prefix_is_verbatim(p: Option) -> bool { match p { Some(VerbatimPrefix(_)) | Some(VerbatimUNCPrefix(_,_)) | Some(VerbatimDiskPrefix) => true, @@ -1136,6 +1129,7 @@ impl Path { #[cfg(test)] mod tests { use super::*; + use super::parse_prefix; use option::{Some,None}; use iter::Iterator; use vec::Vector;