Skip to content

Commit

Permalink
added some documentation and made the memcpy and memmove unsafe
Browse files Browse the repository at this point in the history
  • Loading branch information
Magnus Auvinen authored and brson committed Feb 7, 2012
1 parent 3e98593 commit a5fc0b0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/libcore/ptr.rs
Expand Up @@ -57,15 +57,17 @@ fn null<T>() -> *T unsafe { ret unsafe::reinterpret_cast(0u); }
Function: memcpy
Copies data from one src to dst that is not overlapping each other.
Count is the number of elements to copy and not the number of bytes.
*/
fn memcpy<T>(dst: *T, src: *T, count: uint) unsafe { rusti::memcpy(dst, src, count); }
unsafe fn memcpy<T>(dst: *T, src: *T, count: uint) { rusti::memcpy(dst, src, count); }

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

#[test]
fn test() unsafe {
Expand Down

0 comments on commit a5fc0b0

Please sign in to comment.