@@ -38,8 +38,9 @@ unnecessary amounts of allocations.
38
38
39
39
Be carefull to remember that the memory is managed by C allocator API and not
40
40
by Rust allocator API.
41
- That means that the CString pointers should only be freed with C allocator API
42
- if you intend to do that on your own.
41
+ That means that the CString pointers should be freed with C allocator API
42
+ if you intend to do that on your own, as the behaviour if you free them with
43
+ Rust's allocator API is not well defined
43
44
44
45
An example of creating and using a C string would be:
45
46
@@ -137,8 +138,8 @@ impl<S: hash::Writer> hash::Hash<S> for CString {
137
138
138
139
impl CString {
139
140
/// Create a C String from a pointer, with memory managed by C's allocator
140
- /// API, so do not call it with a pointer to memory managed by Rust's
141
- /// allocator API.
141
+ /// API, so avoid calling it with a pointer to memory managed by Rust's
142
+ /// allocator API, as the behaviour would not be well defined .
142
143
///
143
144
///# Failure
144
145
///
@@ -272,7 +273,7 @@ impl CString {
272
273
/// forgotten, meaning that the backing allocation of this
273
274
/// `CString` is not automatically freed if it owns the
274
275
/// allocation. In this case, a user of `.unwrap()` should ensure
275
- /// the allocation is freed, to avoid leaking memory. You have to
276
+ /// the allocation is freed, to avoid leaking memory. You should
276
277
/// use libc's memory allocator in this case.
277
278
///
278
279
/// Prefer `.as_ptr()` when just retrieving a pointer to the
0 commit comments