@@ -469,20 +469,20 @@ pub fn shift<T>(v: &mut ~[T]) -> T unsafe {
469469 // We still should have room to work where what last element was
470470 assert capacity( v) >= ln;
471471 // Pretend like we have the original length so we can use
472- // the vector memcpy to overwrite the hole we just made
472+ // the vector copy_memory to overwrite the hole we just made
473473 raw:: set_len ( v, ln) ;
474474
475475 // Memcopy the head element (the one we want) to the location we just
476476 // popped. For the moment it unsafely exists at both the head and last
477477 // positions
478478 let first_slice = view ( * v, 0 , 1 ) ;
479479 let last_slice = mut_view ( * v, next_ln, ln) ;
480- raw:: memcpy ( last_slice, first_slice, 1 ) ;
480+ raw:: copy_memory ( last_slice, first_slice, 1 ) ;
481481
482482 // Memcopy everything to the left one element
483483 let init_slice = mut_view ( * v, 0 , next_ln) ;
484484 let tail_slice = view ( * v, 1 , ln) ;
485- raw:: memcpy ( init_slice, tail_slice, next_ln) ;
485+ raw:: copy_memory ( init_slice, tail_slice, next_ln) ;
486486
487487 // Set the new length. Now the vector is back to normal
488488 raw:: set_len ( v, next_ln) ;
@@ -2071,7 +2071,7 @@ pub mod raw {
20712071 pub unsafe fn from_buf_raw < T > ( ptr : * T , elts : uint ) -> ~[ T ] {
20722072 let mut dst = with_capacity ( elts) ;
20732073 set_len ( & mut dst, elts) ;
2074- as_mut_buf ( dst, |p_dst, _len_dst| ptr:: memcpy ( p_dst, ptr, elts) ) ;
2074+ as_mut_buf ( dst, |p_dst, _len_dst| ptr:: copy_memory ( p_dst, ptr, elts) ) ;
20752075 dst
20762076 }
20772077
@@ -2081,13 +2081,13 @@ pub mod raw {
20812081 * Copies `count` bytes from `src` to `dst`. The source and destination
20822082 * may overlap.
20832083 */
2084- pub unsafe fn memcpy < T > ( dst : & [ mut T ] , src : & [ const T ] , count : uint ) {
2084+ pub unsafe fn copy_memory < T > ( dst : & [ mut T ] , src : & [ const T ] , count : uint ) {
20852085 assert dst. len ( ) >= count;
20862086 assert src. len ( ) >= count;
20872087
20882088 do as_mut_buf( dst) |p_dst, _len_dst| {
20892089 do as_const_buf ( src) |p_src, _len_src| {
2090- ptr:: memcpy ( p_dst, p_src, count)
2090+ ptr:: copy_memory ( p_dst, p_src, count)
20912091 }
20922092 }
20932093 }
@@ -2098,13 +2098,13 @@ pub mod raw {
20982098 * Copies `count` bytes from `src` to `dst`. The source and destination
20992099 * may overlap.
21002100 */
2101- pub unsafe fn memmove < T > ( dst : & [ mut T ] , src : & [ const T ] , count : uint ) {
2101+ pub unsafe fn copy_overlapping_memory < T > ( dst : & [ mut T ] , src : & [ const T ] , count : uint ) {
21022102 assert dst. len ( ) >= count;
21032103 assert src. len ( ) >= count;
21042104
21052105 do as_mut_buf( dst) |p_dst, _len_dst| {
21062106 do as_const_buf ( src) |p_src, _len_src| {
2107- ptr:: memmove ( p_dst, p_src, count)
2107+ ptr:: copy_overlapping_memory ( p_dst, p_src, count)
21082108 }
21092109 }
21102110 }
@@ -2163,9 +2163,9 @@ pub mod bytes {
21632163 * Copies `count` bytes from `src` to `dst`. The source and destination
21642164 * may not overlap.
21652165 */
2166- pub fn memcpy ( dst : & [ mut u8] , src : & [ const u8 ] , count : uint ) {
2167- // Bound checks are done at vec::raw::memcpy .
2168- unsafe { vec:: raw:: memcpy ( dst, src, count) }
2166+ pub fn copy_memory ( dst : & [ mut u8] , src : & [ const u8 ] , count : uint ) {
2167+ // Bound checks are done at vec::raw::copy_memory .
2168+ unsafe { vec:: raw:: copy_memory ( dst, src, count) }
21692169 }
21702170
21712171 /**
@@ -2174,9 +2174,9 @@ pub mod bytes {
21742174 * Copies `count` bytes from `src` to `dst`. The source and destination
21752175 * may overlap.
21762176 */
2177- pub fn memmove ( dst : & [ mut u8] , src : & [ const u8 ] , count : uint ) {
2178- // Bound checks are done at vec::raw::memmove .
2179- unsafe { vec:: raw:: memmove ( dst, src, count) }
2177+ pub fn copy_overlapping_memory ( dst : & [ mut u8] , src : & [ const u8 ] , count : uint ) {
2178+ // Bound checks are done at vec::raw::copy_overlapping_memory .
2179+ unsafe { vec:: raw:: copy_overlapping_memory ( dst, src, count) }
21802180 }
21812181}
21822182
@@ -3879,10 +3879,10 @@ mod tests {
38793879 #[ test]
38803880 #[ should_fail]
38813881 #[ ignore( cfg( windows) ) ]
3882- fn test_memcpy_oob ( ) unsafe {
3882+ fn test_copy_memory_oob ( ) unsafe {
38833883 let a = [ mut 1 , 2 , 3 , 4 ] ;
38843884 let b = [ 1 , 2 , 3 , 4 , 5 ] ;
3885- raw:: memcpy ( a, b, 5 ) ;
3885+ raw:: copy_memory ( a, b, 5 ) ;
38863886 }
38873887
38883888}
0 commit comments