Skip to content

Commit a8ff9f2

Browse files
cpetersobrson
authored andcommitted
Rename copy_overlapping_memory() to copy_memory()
1 parent 97b20f8 commit a8ff9f2

File tree

2 files changed

+2
-52
lines changed

2 files changed

+2
-52
lines changed

src/libcore/ptr.rs

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,6 @@ use vec;
2525
#[nolink]
2626
#[abi = "cdecl"]
2727
extern mod libc_ {
28-
#[rust_stack]
29-
unsafe fn memcpy(dest: *mut c_void,
30-
src: *const c_void,
31-
n: libc::size_t)
32-
-> *c_void;
33-
3428
#[rust_stack]
3529
unsafe fn memmove(dest: *mut c_void,
3630
src: *const c_void,
@@ -115,27 +109,14 @@ pub pure fn is_null<T>(ptr: *const T) -> bool { ptr == null() }
115109
#[inline(always)]
116110
pub pure fn is_not_null<T>(ptr: *const T) -> bool { !is_null(ptr) }
117111

118-
/**
119-
* Copies data from one location to another
120-
*
121-
* Copies `count` elements (not bytes) from `src` to `dst`. The source
122-
* and destination may not overlap.
123-
*/
124-
#[inline(always)]
125-
pub unsafe fn copy_memory<T>(dst: *mut T, src: *const T, count: uint) {
126-
let n = count * sys::size_of::<T>();
127-
libc_::memcpy(dst as *mut c_void, src as *c_void, n as size_t);
128-
}
129-
130112
/**
131113
* Copies data from one location to another
132114
*
133115
* Copies `count` elements (not bytes) from `src` to `dst`. The source
134116
* and destination may overlap.
135117
*/
136118
#[inline(always)]
137-
pub unsafe fn copy_overlapping_memory<T>(dst: *mut T, src: *const T,
138-
count: uint) {
119+
pub unsafe fn copy_memory<T>(dst: *mut T, src: *const T, count: uint) {
139120
let n = count * sys::size_of::<T>();
140121
libc_::memmove(dst as *mut c_void, src as *c_void, n as size_t);
141122
}
@@ -146,7 +127,6 @@ pub unsafe fn set_memory<T>(dst: *mut T, c: int, count: uint) {
146127
libc_::memset(dst as *mut c_void, c as libc::c_int, n as size_t);
147128
}
148129

149-
150130
/**
151131
Transform a region pointer - &T - to an unsafe pointer - *T.
152132
This is safe, but is implemented with an unsafe block due to

src/libcore/vec.rs

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2095,24 +2095,6 @@ pub mod raw {
20952095
}
20962096
}
20972097
}
2098-
2099-
/**
2100-
* Copies data from one vector to another.
2101-
*
2102-
* Copies `count` bytes from `src` to `dst`. The source and destination
2103-
* may overlap.
2104-
*/
2105-
pub unsafe fn copy_overlapping_memory<T>(dst: &[mut T], src: &[const T],
2106-
count: uint) {
2107-
assert dst.len() >= count;
2108-
assert src.len() >= count;
2109-
2110-
do as_mut_buf(dst) |p_dst, _len_dst| {
2111-
do as_const_buf(src) |p_src, _len_src| {
2112-
ptr::copy_overlapping_memory(p_dst, p_src, count)
2113-
}
2114-
}
2115-
}
21162098
}
21172099

21182100
/// Operations on `[u8]`
@@ -2166,24 +2148,12 @@ pub mod bytes {
21662148
* Copies data from one vector to another.
21672149
*
21682150
* Copies `count` bytes from `src` to `dst`. The source and destination
2169-
* may not overlap.
2151+
* may overlap.
21702152
*/
21712153
pub fn copy_memory(dst: &[mut u8], src: &[const u8], count: uint) {
21722154
// Bound checks are done at vec::raw::copy_memory.
21732155
unsafe { vec::raw::copy_memory(dst, src, count) }
21742156
}
2175-
2176-
/**
2177-
* Copies data from one vector to another.
2178-
*
2179-
* Copies `count` bytes from `src` to `dst`. The source and destination
2180-
* may overlap.
2181-
*/
2182-
pub fn copy_overlapping_memory(dst: &[mut u8], src: &[const u8],
2183-
count: uint) {
2184-
// Bound checks are done at vec::raw::copy_overlapping_memory.
2185-
unsafe { vec::raw::copy_overlapping_memory(dst, src, count) }
2186-
}
21872157
}
21882158

21892159
// ___________________________________________________________________________

0 commit comments

Comments
 (0)