@@ -471,20 +471,20 @@ pub fn shift<T>(v: &mut ~[T]) -> T unsafe {
471
471
// We still should have room to work where what last element was
472
472
assert capacity( v) >= ln;
473
473
// Pretend like we have the original length so we can use
474
- // the vector memcpy to overwrite the hole we just made
474
+ // the vector copy_memory to overwrite the hole we just made
475
475
raw:: set_len ( v, ln) ;
476
476
477
477
// Memcopy the head element (the one we want) to the location we just
478
478
// popped. For the moment it unsafely exists at both the head and last
479
479
// positions
480
480
let first_slice = view ( * v, 0 , 1 ) ;
481
481
let last_slice = mut_view ( * v, next_ln, ln) ;
482
- raw:: memcpy ( last_slice, first_slice, 1 ) ;
482
+ raw:: copy_memory ( last_slice, first_slice, 1 ) ;
483
483
484
484
// Memcopy everything to the left one element
485
485
let init_slice = mut_view ( * v, 0 , next_ln) ;
486
486
let tail_slice = view ( * v, 1 , ln) ;
487
- raw:: memcpy ( init_slice, tail_slice, next_ln) ;
487
+ raw:: copy_memory ( init_slice, tail_slice, next_ln) ;
488
488
489
489
// Set the new length. Now the vector is back to normal
490
490
raw:: set_len ( v, next_ln) ;
@@ -2075,7 +2075,7 @@ pub mod raw {
2075
2075
pub unsafe fn from_buf_raw < T > ( ptr : * T , elts : uint ) -> ~[ T ] {
2076
2076
let mut dst = with_capacity ( elts) ;
2077
2077
set_len ( & mut dst, elts) ;
2078
- as_mut_buf ( dst, |p_dst, _len_dst| ptr:: memcpy ( p_dst, ptr, elts) ) ;
2078
+ as_mut_buf ( dst, |p_dst, _len_dst| ptr:: copy_memory ( p_dst, ptr, elts) ) ;
2079
2079
dst
2080
2080
}
2081
2081
@@ -2085,13 +2085,13 @@ pub mod raw {
2085
2085
* Copies `count` bytes from `src` to `dst`. The source and destination
2086
2086
* may overlap.
2087
2087
*/
2088
- pub unsafe fn memcpy < T > ( dst : & [ mut T ] , src : & [ const T ] , count : uint ) {
2088
+ pub unsafe fn copy_memory < T > ( dst : & [ mut T ] , src : & [ const T ] , count : uint ) {
2089
2089
assert dst. len ( ) >= count;
2090
2090
assert src. len ( ) >= count;
2091
2091
2092
2092
do as_mut_buf( dst) |p_dst, _len_dst| {
2093
2093
do as_const_buf ( src) |p_src, _len_src| {
2094
- ptr:: memcpy ( p_dst, p_src, count)
2094
+ ptr:: copy_memory ( p_dst, p_src, count)
2095
2095
}
2096
2096
}
2097
2097
}
@@ -2102,13 +2102,13 @@ pub mod raw {
2102
2102
* Copies `count` bytes from `src` to `dst`. The source and destination
2103
2103
* may overlap.
2104
2104
*/
2105
- pub unsafe fn memmove < T > ( dst : & [ mut T ] , src : & [ const T ] , count : uint ) {
2105
+ pub unsafe fn copy_overlapping_memory < T > ( dst : & [ mut T ] , src : & [ const T ] , count : uint ) {
2106
2106
assert dst. len ( ) >= count;
2107
2107
assert src. len ( ) >= count;
2108
2108
2109
2109
do as_mut_buf( dst) |p_dst, _len_dst| {
2110
2110
do as_const_buf ( src) |p_src, _len_src| {
2111
- ptr:: memmove ( p_dst, p_src, count)
2111
+ ptr:: copy_overlapping_memory ( p_dst, p_src, count)
2112
2112
}
2113
2113
}
2114
2114
}
@@ -2167,9 +2167,9 @@ pub mod bytes {
2167
2167
* Copies `count` bytes from `src` to `dst`. The source and destination
2168
2168
* may not overlap.
2169
2169
*/
2170
- pub fn memcpy ( dst : & [ mut u8] , src : & [ const u8 ] , count : uint ) {
2171
- // Bound checks are done at vec::raw::memcpy .
2172
- unsafe { vec:: raw:: memcpy ( dst, src, count) }
2170
+ pub fn copy_memory ( dst : & [ mut u8] , src : & [ const u8 ] , count : uint ) {
2171
+ // Bound checks are done at vec::raw::copy_memory .
2172
+ unsafe { vec:: raw:: copy_memory ( dst, src, count) }
2173
2173
}
2174
2174
2175
2175
/**
@@ -2178,9 +2178,9 @@ pub mod bytes {
2178
2178
* Copies `count` bytes from `src` to `dst`. The source and destination
2179
2179
* may overlap.
2180
2180
*/
2181
- pub fn memmove ( dst : & [ mut u8] , src : & [ const u8 ] , count : uint ) {
2182
- // Bound checks are done at vec::raw::memmove .
2183
- unsafe { vec:: raw:: memmove ( dst, src, count) }
2181
+ pub fn copy_overlapping_memory ( dst : & [ mut u8] , src : & [ const u8 ] , count : uint ) {
2182
+ // Bound checks are done at vec::raw::copy_overlapping_memory .
2183
+ unsafe { vec:: raw:: copy_overlapping_memory ( dst, src, count) }
2184
2184
}
2185
2185
}
2186
2186
@@ -3896,10 +3896,10 @@ mod tests {
3896
3896
#[ test]
3897
3897
#[ should_fail]
3898
3898
#[ ignore( cfg( windows) ) ]
3899
- fn test_memcpy_oob ( ) unsafe {
3899
+ fn test_copy_memory_oob ( ) unsafe {
3900
3900
let a = [ mut 1 , 2 , 3 , 4 ] ;
3901
3901
let b = [ 1 , 2 , 3 , 4 , 5 ] ;
3902
- raw:: memcpy ( a, b, 5 ) ;
3902
+ raw:: copy_memory ( a, b, 5 ) ;
3903
3903
}
3904
3904
3905
3905
}
0 commit comments