Skip to content

Commit 1f2918c

Browse files
committed
---
yaml --- r: 155266 b: refs/heads/try2 c: 6a37692 h: refs/heads/master v: v3
1 parent 86b2fb7 commit 1f2918c

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
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: 9ce2c51c4677865da469e61d22602752c39679da
8+
refs/heads/try2: 6a37692ecbb88cd9c3ae06a7ae9d619aa535719d
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/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)