Skip to content

Commit

Permalink
Rollup merge of #28788 - tsurai:master, r=bluss
Browse files Browse the repository at this point in the history
Please correct me if I confused something but the documentation for ```into_ptr``` and ```into_raw``` of ```CString``` seem to be swapped as the docs for ```into_ptr``` mentions ```into_raw``` and vice versa.

Update: I actually meant ```into_ptr``` and ```into_raw``` NOT ```from_*```
  • Loading branch information
steveklabnik committed Oct 1, 2015
2 parents 1f9fb33 + 25c2134 commit 89bcb77
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/libstd/ffi/c_str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ impl CString {
/// Retakes ownership of a CString that was transferred to C.
///
/// The only appropriate argument is a pointer obtained by calling
/// `into_ptr`. The length of the string will be recalculated
/// `into_raw`. The length of the string will be recalculated
/// using the pointer.
#[unstable(feature = "cstr_memory2", reason = "recently added",
issue = "27769")]
Expand Down Expand Up @@ -245,11 +245,11 @@ impl CString {
/// Transfers ownership of the string to a C caller.
///
/// The pointer must be returned to Rust and reconstituted using
/// `from_ptr` to be properly deallocated. Specifically, one
/// `from_raw` to be properly deallocated. Specifically, one
/// should *not* use the standard C `free` function to deallocate
/// this string.
///
/// Failure to call `from_ptr` will lead to a memory leak.
/// Failure to call `from_raw` will lead to a memory leak.
#[stable(feature = "cstr_memory", since = "1.4.0")]
pub fn into_raw(self) -> *mut libc::c_char {
Box::into_raw(self.inner) as *mut libc::c_char
Expand Down

0 comments on commit 89bcb77

Please sign in to comment.