Skip to content

Commit bd0bb98

Browse files
committed
---
yaml --- r: 143203 b: refs/heads/try2 c: 9ad815e h: refs/heads/master i: 143201: 983169c 143199: 2645716 v: v3
1 parent 200470d commit bd0bb98

File tree

4 files changed

+9
-10
lines changed

4 files changed

+9
-10
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: 7434080dd7c0cd072d7e51fbb1e174e954bdc011
8+
refs/heads/try2: 9ad815e063e8c7785cc10ea1afac55a19ea4e51a
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/src/libextra/terminfo/parm.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -545,7 +545,7 @@ priv fn format(val: Param, op: FormatOp, flags: Flags) -> Result<~[u8],~str> {
545545
String(s) => {
546546
match op {
547547
FormatString => {
548-
let mut s = s.as_bytes_with_null_consume();
548+
let mut s = s.to_bytes_with_null();
549549
s.pop(); // remove the null
550550
if flags.precision > 0 && flags.precision < s.len() {
551551
s.truncate(flags.precision);

branches/try2/src/libstd/str.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2073,8 +2073,7 @@ pub trait OwnedStr {
20732073
fn reserve(&mut self, n: uint);
20742074
fn reserve_at_least(&mut self, n: uint);
20752075
fn capacity(&self) -> uint;
2076-
2077-
fn as_bytes_with_null_consume(self) -> ~[u8];
2076+
fn to_bytes_with_null(self) -> ~[u8];
20782077
}
20792078
20802079
impl OwnedStr for ~str {
@@ -2263,7 +2262,7 @@ impl OwnedStr for ~str {
22632262
/// Convert to a vector of bytes. This does not allocate a new
22642263
/// string, and includes the null terminator.
22652264
#[inline]
2266-
fn as_bytes_with_null_consume(self) -> ~[u8] {
2265+
fn to_bytes_with_null(self) -> ~[u8] {
22672266
unsafe { ::cast::transmute(self) }
22682267
}
22692268
}
@@ -3065,17 +3064,17 @@ mod tests {
30653064
}
30663065
30673066
#[test]
3068-
fn test_as_bytes_with_null_consume() {
3067+
fn test_to_bytes_with_null() {
30693068
let s = ~"ศไทย中华Việt Nam";
30703069
let v = ~[
30713070
224, 184, 168, 224, 185, 132, 224, 184, 151, 224, 184, 162, 228,
30723071
184, 173, 229, 141, 142, 86, 105, 225, 187, 135, 116, 32, 78, 97,
30733072
109, 0
30743073
];
3075-
assert_eq!((~"").as_bytes_with_null_consume(), ~[0]);
3076-
assert_eq!((~"abc").as_bytes_with_null_consume(),
3074+
assert_eq!((~"").to_bytes_with_null(), ~[0]);
3075+
assert_eq!((~"abc").to_bytes_with_null(),
30773076
~['a' as u8, 'b' as u8, 'c' as u8, 0]);
3078-
assert_eq!(s.as_bytes_with_null_consume(), v);
3077+
assert_eq!(s.to_bytes_with_null(), v);
30793078
}
30803079
30813080
#[test]

branches/try2/src/test/run-pass/foreign-fn-linkname.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ mod libc {
2626
fn strlen(str: ~str) -> uint {
2727
unsafe {
2828
// C string is terminated with a zero
29-
let bytes = str.as_bytes_with_null_consume();
29+
let bytes = str.to_bytes_with_null();
3030
return libc::my_strlen(vec::raw::to_ptr(bytes));
3131
}
3232
}

0 commit comments

Comments
 (0)