about summary refs log tree commit diff
diff options
context:
space:
mode:
authorChris Peterson <cpeterson@mozilla.com>2013-01-14 23:36:45 -0800
committerBrian Anderson <banderson@mozilla.com>2013-01-18 14:38:46 -0800
commita8ff9f2ef9fd29ef937d2d2955c2ad8ee3b4b305 (patch)
treecccb0397f554bd8d155ffe005b562fcf7d6f74be
parent97b20f8e024096b903b8ec05bd39d0387d9190cb (diff)
downloadrust-a8ff9f2ef9fd29ef937d2d2955c2ad8ee3b4b305.tar.gz
rust-a8ff9f2ef9fd29ef937d2d2955c2ad8ee3b4b305.zip
Rename copy_overlapping_memory() to copy_memory()
-rw-r--r--src/libcore/ptr.rs22
-rw-r--r--src/libcore/vec.rs32
2 files changed, 2 insertions, 52 deletions
diff --git a/src/libcore/ptr.rs b/src/libcore/ptr.rs
index 17c3c11e572..513a3095292 100644
--- a/src/libcore/ptr.rs
+++ b/src/libcore/ptr.rs
@@ -26,12 +26,6 @@ use vec;
 #[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,
                       n: libc::size_t)
@@ -119,23 +113,10 @@ pub pure fn is_not_null<T>(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<T>(dst: *mut T, src: *const T, count: uint) {
-    let n = count * sys::size_of::<T>();
-    libc_::memcpy(dst as *mut c_void, src as *c_void, n as size_t);
-}
-
-/**
- * Copies data from one location to another
- *
- * Copies `count` elements (not bytes) from `src` to `dst`. The source
  * and destination may overlap.
  */
 #[inline(always)]
-pub unsafe fn copy_overlapping_memory<T>(dst: *mut T, src: *const T,
-                                         count: uint) {
+pub unsafe fn copy_memory<T>(dst: *mut T, src: *const T, count: uint) {
     let n = count * sys::size_of::<T>();
     libc_::memmove(dst as *mut c_void, src as *c_void, n as size_t);
 }
@@ -146,7 +127,6 @@ pub unsafe fn set_memory<T>(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 1caf569e77d..e6c2211b593 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<T>(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) }
-    }
 }
 
 // ___________________________________________________________________________