Skip to content

Commit 44543b5

Browse files
committed
---
yaml --- r: 21500 b: refs/heads/snap-stage3 c: 7bb6584 h: refs/heads/master v: v3
1 parent cd48b01 commit 44543b5

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
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: e430a699f2c60890d9b86069fd0c68a70ece7120
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 94c3975a9a4948a17cc63022e3ba5dbe87171a9d
4+
refs/heads/snap-stage3: 7bb65848a15c2970f1b7a52e870bfc98c9c981a9
55
refs/heads/try: ffbe0e0e00374358b789b0037bcb3a577cd218be
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/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/snap-stage3/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/snap-stage3/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)