@@ -469,20 +469,20 @@ pub fn shift<T>(v: &mut ~[T]) -> T unsafe {
469
469
// We still should have room to work where what last element was
470
470
assert capacity( v) >= ln;
471
471
// 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
473
473
raw:: set_len ( v, ln) ;
474
474
475
475
// Memcopy the head element (the one we want) to the location we just
476
476
// popped. For the moment it unsafely exists at both the head and last
477
477
// positions
478
478
let first_slice = view ( * v, 0 , 1 ) ;
479
479
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 ) ;
481
481
482
482
// Memcopy everything to the left one element
483
483
let init_slice = mut_view ( * v, 0 , next_ln) ;
484
484
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) ;
486
486
487
487
// Set the new length. Now the vector is back to normal
488
488
raw:: set_len ( v, next_ln) ;
@@ -2071,7 +2071,7 @@ pub mod raw {
2071
2071
pub unsafe fn from_buf_raw < T > ( ptr : * T , elts : uint ) -> ~[ T ] {
2072
2072
let mut dst = with_capacity ( elts) ;
2073
2073
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) ) ;
2075
2075
dst
2076
2076
}
2077
2077
@@ -2081,13 +2081,13 @@ pub mod raw {
2081
2081
* Copies `count` bytes from `src` to `dst`. The source and destination
2082
2082
* may overlap.
2083
2083
*/
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 ) {
2085
2085
assert dst. len ( ) >= count;
2086
2086
assert src. len ( ) >= count;
2087
2087
2088
2088
do as_mut_buf( dst) |p_dst, _len_dst| {
2089
2089
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)
2091
2091
}
2092
2092
}
2093
2093
}
@@ -2098,13 +2098,13 @@ pub mod raw {
2098
2098
* Copies `count` bytes from `src` to `dst`. The source and destination
2099
2099
* may overlap.
2100
2100
*/
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 ) {
2102
2102
assert dst. len ( ) >= count;
2103
2103
assert src. len ( ) >= count;
2104
2104
2105
2105
do as_mut_buf( dst) |p_dst, _len_dst| {
2106
2106
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)
2108
2108
}
2109
2109
}
2110
2110
}
@@ -2163,9 +2163,9 @@ pub mod bytes {
2163
2163
* Copies `count` bytes from `src` to `dst`. The source and destination
2164
2164
* may not overlap.
2165
2165
*/
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) }
2169
2169
}
2170
2170
2171
2171
/**
@@ -2174,9 +2174,9 @@ pub mod bytes {
2174
2174
* Copies `count` bytes from `src` to `dst`. The source and destination
2175
2175
* may overlap.
2176
2176
*/
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) }
2180
2180
}
2181
2181
}
2182
2182
@@ -3879,10 +3879,10 @@ mod tests {
3879
3879
#[ test]
3880
3880
#[ should_fail]
3881
3881
#[ ignore( cfg( windows) ) ]
3882
- fn test_memcpy_oob ( ) unsafe {
3882
+ fn test_copy_memory_oob ( ) unsafe {
3883
3883
let a = [ mut 1 , 2 , 3 , 4 ] ;
3884
3884
let b = [ 1 , 2 , 3 , 4 , 5 ] ;
3885
- raw:: memcpy ( a, b, 5 ) ;
3885
+ raw:: copy_memory ( a, b, 5 ) ;
3886
3886
}
3887
3887
3888
3888
}
0 commit comments