diff options
| author | Daniel Micay <danielmicay@gmail.com> | 2013-06-06 15:18:06 -0400 |
|---|---|---|
| committer | Daniel Micay <danielmicay@gmail.com> | 2013-06-06 15:18:45 -0400 |
| commit | 8bcefef2f2747dc7b2f48ba7924101dc70492cf0 (patch) | |
| tree | 45cc2b6b66060e3f53a0a12d5bcbd2f467276d28 /src/libstd/libc.rs | |
| parent | 0e9636922410d4c905135e93056fd86f1f49da30 (diff) | |
libc: omit memcpy, memmove and memset
LLVM provides these functions as intrinsics, and will generate calls to libc when appropriate. They are exposed in the `ptr` module as `copy_nonoverlapping_memory`, `copy_memory` and `set_memory`.
Diffstat (limited to 'src/libstd/libc.rs')
| -rw-r--r-- | src/libstd/libc.rs | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/src/libstd/libc.rs b/src/libstd/libc.rs index 142b2f7d6af..26205c930f0 100644 --- a/src/libstd/libc.rs +++ b/src/libstd/libc.rs @@ -159,8 +159,8 @@ pub use libc::funcs::c95::stdlib::{free, getenv, labs, malloc, rand}; pub use libc::funcs::c95::stdlib::{realloc, srand, strtod, strtol}; pub use libc::funcs::c95::stdlib::{strtoul, system}; -pub use libc::funcs::c95::string::{memchr, memcmp, memcpy, memmove}; -pub use libc::funcs::c95::string::{memset, strcat, strchr, strcmp}; +pub use libc::funcs::c95::string::{memchr, memcmp}; +pub use libc::funcs::c95::string::{strcat, strchr, strcmp}; pub use libc::funcs::c95::string::{strcoll, strcpy, strcspn, strerror}; pub use libc::funcs::c95::string::{strlen, strncat, strncmp, strncpy}; pub use libc::funcs::c95::string::{strpbrk, strrchr, strspn, strstr}; @@ -1452,26 +1452,17 @@ pub mod funcs { -> size_t; unsafe fn wcslen(buf: *wchar_t) -> size_t; + // Omitted: memcpy, memmove, memset (provided by LLVM) + // These are fine to execute on the Rust stack. They must be, // in fact, because LLVM generates calls to them! #[rust_stack] #[inline(always)] - unsafe fn memcpy(s: *c_void, ct: *c_void, n: size_t) - -> *c_void; - #[rust_stack] - #[inline(always)] - unsafe fn memmove(s: *c_void, ct: *c_void, n: size_t) - -> *c_void; - #[rust_stack] - #[inline(always)] unsafe fn memcmp(cx: *c_void, ct: *c_void, n: size_t) -> c_int; #[rust_stack] #[inline(always)] unsafe fn memchr(cx: *c_void, c: c_int, n: size_t) -> *c_void; - #[rust_stack] - #[inline(always)] - unsafe fn memset(s: *c_void, c: c_int, n: size_t) -> *c_void; } } } |
