From 7dfcc8ef6878df139102e376f7bd9654b241c6d3 Mon Sep 17 00:00:00 2001 From: Chris Peterson Date: Mon, 14 Jan 2013 23:36:45 -0800 Subject: [PATCH] Rename copy_overlapping_memory() to copy_memory() --- src/libcore/ptr.rs | 22 +--------------------- src/libcore/vec.rs | 32 +------------------------------- 2 files changed, 2 insertions(+), 52 deletions(-) diff --git a/src/libcore/ptr.rs b/src/libcore/ptr.rs index 17c3c11e572d2..513a3095292c0 100644 --- a/src/libcore/ptr.rs +++ b/src/libcore/ptr.rs @@ -25,12 +25,6 @@ use vec; #[nolink] #[abi = "cdecl"] extern mod libc_ { - #[rust_stack] - unsafe fn memcpy(dest: *mut c_void, - src: *const c_void, - n: libc::size_t) - -> *c_void; - #[rust_stack] unsafe fn memmove(dest: *mut c_void, src: *const c_void, @@ -115,18 +109,6 @@ pub pure fn is_null(ptr: *const T) -> bool { ptr == null() } #[inline(always)] pub pure fn is_not_null(ptr: *const T) -> bool { !is_null(ptr) } -/** - * Copies data from one location to another - * - * Copies `count` elements (not bytes) from `src` to `dst`. The source - * and destination may not overlap. - */ -#[inline(always)] -pub unsafe fn copy_memory(dst: *mut T, src: *const T, count: uint) { - let n = count * sys::size_of::(); - libc_::memcpy(dst as *mut c_void, src as *c_void, n as size_t); -} - /** * Copies data from one location to another * @@ -134,8 +116,7 @@ pub unsafe fn copy_memory(dst: *mut T, src: *const T, count: uint) { * and destination may overlap. */ #[inline(always)] -pub unsafe fn copy_overlapping_memory(dst: *mut T, src: *const T, - count: uint) { +pub unsafe fn copy_memory(dst: *mut T, src: *const T, count: uint) { let n = count * sys::size_of::(); libc_::memmove(dst as *mut c_void, src as *c_void, n as size_t); } @@ -146,7 +127,6 @@ pub unsafe fn set_memory(dst: *mut T, c: int, count: uint) { libc_::memset(dst as *mut c_void, c as libc::c_int, n as size_t); } - /** Transform a region pointer - &T - to an unsafe pointer - *T. This is safe, but is implemented with an unsafe block due to diff --git a/src/libcore/vec.rs b/src/libcore/vec.rs index 49a0e5b21090e..a271dfaef9004 100644 --- a/src/libcore/vec.rs +++ b/src/libcore/vec.rs @@ -2095,24 +2095,6 @@ pub mod raw { } } } - - /** - * Copies data from one vector to another. - * - * Copies `count` bytes from `src` to `dst`. The source and destination - * may overlap. - */ - pub unsafe fn copy_overlapping_memory(dst: &[mut T], src: &[const T], - count: uint) { - assert dst.len() >= count; - assert src.len() >= count; - - do as_mut_buf(dst) |p_dst, _len_dst| { - do as_const_buf(src) |p_src, _len_src| { - ptr::copy_overlapping_memory(p_dst, p_src, count) - } - } - } } /// Operations on `[u8]` @@ -2166,24 +2148,12 @@ pub mod bytes { * Copies data from one vector to another. * * Copies `count` bytes from `src` to `dst`. The source and destination - * may not overlap. + * may overlap. */ pub fn copy_memory(dst: &[mut u8], src: &[const u8], count: uint) { // Bound checks are done at vec::raw::copy_memory. unsafe { vec::raw::copy_memory(dst, src, count) } } - - /** - * Copies data from one vector to another. - * - * Copies `count` bytes from `src` to `dst`. The source and destination - * may overlap. - */ - pub fn copy_overlapping_memory(dst: &[mut u8], src: &[const u8], - count: uint) { - // Bound checks are done at vec::raw::copy_overlapping_memory. - unsafe { vec::raw::copy_overlapping_memory(dst, src, count) } - } } // ___________________________________________________________________________