Skip to content

Commit 386c443

Browse files
committed
---
yaml --- r: 32270 b: refs/heads/dist-snap c: 7bb6584 h: refs/heads/master v: v3
1 parent 7efc9ed commit 386c443

File tree

4 files changed

+9
-15
lines changed

4 files changed

+9
-15
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: d0c6ce338884ee21843f4b40bf6bf18d222ce5df
99
refs/heads/incoming: d9317a174e434d4c99fc1a37fd7dc0d2f5328d37
10-
refs/heads/dist-snap: 94c3975a9a4948a17cc63022e3ba5dbe87171a9d
10+
refs/heads/dist-snap: 7bb65848a15c2970f1b7a52e870bfc98c9c981a9
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/dist-snap/src/libcore/str.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,6 @@ export
117117

118118
#[abi = "cdecl"]
119119
extern mod rustrt {
120-
fn rust_str_push(&s: ~str, ch: u8);
121120
fn str_reserve_shared(&ss: ~str, nn: libc::size_t);
122121
}
123122

@@ -1998,12 +1997,18 @@ mod unsafe {
19981997

19991998
/// Appends a byte to a string. (Not UTF-8 safe).
20001999
unsafe fn push_byte(&s: ~str, b: u8) {
2001-
rustrt::rust_str_push(s, b);
2000+
reserve_at_least(s, s.len() + 1);
2001+
do as_buf(s) |buf, len| {
2002+
let buf: *mut u8 = ::unsafe::reinterpret_cast(buf);
2003+
*ptr::mut_offset(buf, len) = b;
2004+
}
2005+
set_len(s, s.len() + 1);
20022006
}
20032007

20042008
/// Appends a vector of bytes to a string. (Not UTF-8 safe).
20052009
unsafe fn push_bytes(&s: ~str, bytes: ~[u8]) {
2006-
for vec::each(bytes) |byte| { rustrt::rust_str_push(s, byte); }
2010+
reserve_at_least(s, s.len() + bytes.len());
2011+
for vec::each(bytes) |byte| { push_byte(s, byte); }
20072012
}
20082013

20092014
/// Removes the last byte from a string and returns it. (Not UTF-8 safe).

branches/dist-snap/src/rt/rust_builtin.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -148,16 +148,6 @@ str_reserve_shared(rust_vec_box** sp,
148148
reserve_vec_exact(task, sp, n_elts + 1);
149149
}
150150

151-
extern "C" CDECL void
152-
rust_str_push(rust_vec_box** sp, uint8_t byte) {
153-
rust_task *task = rust_get_current_task();
154-
size_t fill = (*sp)->body.fill;
155-
reserve_vec(task, sp, fill + 1);
156-
(*sp)->body.data[fill-1] = byte;
157-
(*sp)->body.data[fill] = 0;
158-
(*sp)->body.fill = fill + 1;
159-
}
160-
161151
extern "C" CDECL rust_vec*
162152
rand_seed() {
163153
size_t size = sizeof(ub4) * RANDSIZ;

branches/dist-snap/src/rt/rustrt.def.in

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ rust_getcwd
3838
rust_get_stdin
3939
rust_get_stdout
4040
rust_get_stderr
41-
rust_str_push
4241
rust_list_files
4342
rust_log_console_on
4443
rust_log_console_off

0 commit comments

Comments
 (0)