Skip to content

Commit a5fc0b0

Browse files
Magnus Auvinenbrson
authored andcommitted
added some documentation and made the memcpy and memmove unsafe
1 parent 3e98593 commit a5fc0b0

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/libcore/ptr.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,15 +57,17 @@ fn null<T>() -> *T unsafe { ret unsafe::reinterpret_cast(0u); }
5757
Function: memcpy
5858
5959
Copies data from one src to dst that is not overlapping each other.
60+
Count is the number of elements to copy and not the number of bytes.
6061
*/
61-
fn memcpy<T>(dst: *T, src: *T, count: uint) unsafe { rusti::memcpy(dst, src, count); }
62+
unsafe fn memcpy<T>(dst: *T, src: *T, count: uint) { rusti::memcpy(dst, src, count); }
6263

6364
/*
6465
Function: memmove
6566
6667
Copies data from one src to dst, overlap between the two pointers may occur.
68+
Count is the number of elements to copy and not the number of bytes.
6769
*/
68-
fn memmove<T>(dst: *T, src: *T, count: uint) unsafe { rusti::memcpy(dst, src, count); }
70+
unsafe fn memmove<T>(dst: *T, src: *T, count: uint) { rusti::memcpy(dst, src, count); }
6971

7072
#[test]
7173
fn test() unsafe {

0 commit comments

Comments
 (0)