Skip to content

Commit ce59e6a

Browse files
committed
---
yaml --- r: 133869 b: refs/heads/snap-stage3 c: 6a37692 h: refs/heads/master i: 133867: 9340987 v: v3
1 parent c10a899 commit ce59e6a

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 0e784e16840e8a0c623cc6166de26da9334db3d6
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 9ce2c51c4677865da469e61d22602752c39679da
4+
refs/heads/snap-stage3: 6a37692ecbb88cd9c3ae06a7ae9d619aa535719d
55
refs/heads/try: 777654cfccbfa39bc7f671d8e9629018ed8ca12d
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/src/librustrt/c_str.rs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@ not tied to the lifetime of the original string/data buffer). If C strings are
3636
heavily used in applications, then caching may be advisable to prevent
3737
unnecessary amounts of allocations.
3838
39-
Be carefull to remember that the memory is managed by libc's malloc and not
40-
by jemalloc which is the 'normal' rust memory allocator.
41-
That means that the CString pointers should only be freed with
42-
alloc::libc_heap::malloc_raw if you intend to do that on your own.
39+
Be carefull to remember that the memory is managed by C allocator API and not
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.
4343
4444
An example of creating and using a C string would be:
4545
@@ -97,7 +97,7 @@ pub struct CString {
9797
impl Clone for CString {
9898
/// Clone this CString into a new, uniquely owned CString. For safety
9999
/// reasons, this is always a deep clone with the memory allocated
100-
/// with libc's malloc, rather than the usual shallow clone.
100+
/// with C's allocator API, rather than the usual shallow clone.
101101
fn clone(&self) -> CString {
102102
let len = self.len() + 1;
103103
let buf = unsafe { malloc_raw(len) } as *mut libc::c_char;
@@ -136,8 +136,9 @@ impl<S: hash::Writer> hash::Hash<S> for CString {
136136
}
137137

138138
impl CString {
139-
/// Create a C String from a pointer, with memory managed by libc's malloc,
140-
/// so do not call it with a pointer allocated by jemalloc.
139+
/// 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.
141142
///
142143
///# Failure
143144
///

0 commit comments

Comments
 (0)