diff options
| author | Michael 'devbug' Williams <m.t.williams@live.com> | 2013-10-10 13:57:55 -0700 |
|---|---|---|
| committer | Michael 'devbug' Williams <m.t.williams@live.com> | 2013-10-10 14:00:15 -0700 |
| commit | bcf76ac3ede5be8b49bebdca6d4c5043e8607aa3 (patch) | |
| tree | c98946aa069e0b8569108b364ab86f7a0cddd1f0 | |
| parent | 8015f9c27ec342dbf0b28c9c0c4769d8b3bcfc9f (diff) | |
| download | rust-bcf76ac3ede5be8b49bebdca6d4c5043e8607aa3.tar.gz rust-bcf76ac3ede5be8b49bebdca6d4c5043e8607aa3.zip | |
Fixed typo under 'Segmented stacks and the linter', and removed superfluous trailing whitespace.
| -rw-r--r-- | doc/tutorial-ffi.md | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/doc/tutorial-ffi.md b/doc/tutorial-ffi.md index 3deaeb14b83..46d37a559bb 100644 --- a/doc/tutorial-ffi.md +++ b/doc/tutorial-ffi.md @@ -135,7 +135,7 @@ the true length after compression for setting the length. ~~~~ {.xfail-test} pub fn compress(src: &[u8]) -> ~[u8] { #[fixed_stack_segment]; #[inline(never)]; - + unsafe { let srclen = src.len() as size_t; let psrc = vec::raw::to_ptr(src); @@ -157,7 +157,7 @@ format and `snappy_uncompressed_length` will retrieve the exact buffer size requ ~~~~ {.xfail-test} pub fn uncompress(src: &[u8]) -> Option<~[u8]> { #[fixed_stack_segment]; #[inline(never)]; - + unsafe { let srclen = src.len() as size_t; let psrc = vec::raw::to_ptr(src); @@ -236,7 +236,7 @@ use std::libc::size_t; unsafe fn snappy_max_compressed_length(source_length: size_t) -> size_t { #[fixed_stack_segment]; #[inline(never)]; return snappy_max_compressed_length(source_length); - + #[link_args = "-lsnappy"] extern { fn snappy_max_compressed_length(source_length: size_t) -> size_t; @@ -259,9 +259,9 @@ check that one of the following conditions holds: 2. The call occurs inside of an `extern fn`; 3. The call occurs within a stack closure created by some other safe fn. - + All of these conditions ensure that you are running on a large stack -segmented. However, they are sometimes too strict. If your application +segment. However, they are sometimes too strict. If your application will be making many calls into C, it is often beneficial to promote the `#[fixed_stack_segment]` attribute higher up the call chain. For example, the Rust compiler actually labels main itself as requiring a @@ -298,7 +298,7 @@ impl<T: Send> Unique<T> { pub fn new(value: T) -> Unique<T> { #[fixed_stack_segment]; #[inline(never)]; - + unsafe { let ptr = malloc(std::sys::size_of::<T>() as size_t) as *mut T; assert!(!ptr::is_null(ptr)); @@ -324,7 +324,7 @@ impl<T: Send> Drop for Unique<T> { fn drop(&mut self) { #[fixed_stack_segment]; #[inline(never)]; - + unsafe { let x = intrinsics::init(); // dummy value to swap in // moving the object out is needed to call the destructor |
