rename vec::raw::form_slice to buf_as_slice
This matches the str::raw function.
This commit is contained in:
parent
81423a3866
commit
8fc3088b2a
@ -349,7 +349,7 @@ pub pure fn to_bytes(s: &str) -> ~[u8] unsafe {
|
||||
#[inline(always)]
|
||||
pub pure fn byte_slice<T>(s: &str, f: fn(v: &[u8]) -> T) -> T {
|
||||
do as_buf(s) |p,n| {
|
||||
unsafe { vec::raw::form_slice(p, n-1u, f) }
|
||||
unsafe { vec::raw::buf_as_slice(p, n-1u, f) }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -226,8 +226,7 @@ pub pure fn to_str_bytes<U>(neg: bool, num: T, radix: uint,
|
||||
*ptr::mut_offset(mp, i) = '-' as u8;
|
||||
}
|
||||
|
||||
vec::raw::form_slice(ptr::offset(p, i),
|
||||
len - i, f)
|
||||
vec::raw::buf_as_slice(ptr::offset(p, i), len - i, f)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1741,8 +1741,9 @@ pub mod raw {
|
||||
* not bytes).
|
||||
*/
|
||||
#[inline(always)]
|
||||
pub unsafe fn form_slice<T,U>(p: *T, len: uint,
|
||||
f: fn(v: &[T]) -> U) -> U {
|
||||
pub unsafe fn buf_as_slice<T,U>(p: *T,
|
||||
len: uint,
|
||||
f: fn(v: &[T]) -> U) -> U {
|
||||
let pair = (p, len * sys::size_of::<T>());
|
||||
let v : *(&blk/[T]) =
|
||||
::cast::reinterpret_cast(&addr_of(&pair));
|
||||
|
@ -193,7 +193,7 @@ fn get_metadata_section(os: os,
|
||||
vlen);
|
||||
let minsz = uint::min(vlen, csz);
|
||||
let mut version_ok = false;
|
||||
do vec::raw::form_slice(cvbuf, minsz) |buf0| {
|
||||
do vec::raw::buf_as_slice(cvbuf, minsz) |buf0| {
|
||||
version_ok = (buf0 ==
|
||||
encoder::metadata_encoding_version);
|
||||
}
|
||||
@ -202,7 +202,7 @@ fn get_metadata_section(os: os,
|
||||
let cvbuf1 = ptr::offset(cvbuf, vlen);
|
||||
debug!("inflating %u bytes of compressed metadata",
|
||||
csz - vlen);
|
||||
do vec::raw::form_slice(cvbuf1, csz-vlen) |bytes| {
|
||||
do vec::raw::buf_as_slice(cvbuf1, csz-vlen) |bytes| {
|
||||
let inflated = flate::inflate_bytes(bytes);
|
||||
found = move Some(@(move inflated));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user