File tree Expand file tree Collapse file tree 4 files changed +9
-15
lines changed Expand file tree Collapse file tree 4 files changed +9
-15
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,6 @@ refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
7
7
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8
8
refs/heads/try2: d0c6ce338884ee21843f4b40bf6bf18d222ce5df
9
9
refs/heads/incoming: d9317a174e434d4c99fc1a37fd7dc0d2f5328d37
10
- refs/heads/dist-snap: 94c3975a9a4948a17cc63022e3ba5dbe87171a9d
10
+ refs/heads/dist-snap: 7bb65848a15c2970f1b7a52e870bfc98c9c981a9
11
11
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
12
12
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
Original file line number Diff line number Diff line change @@ -117,7 +117,6 @@ export
117
117
118
118
#[ abi = "cdecl" ]
119
119
extern mod rustrt {
120
- fn rust_str_push ( & s: ~str , ch : u8 ) ;
121
120
fn str_reserve_shared ( & ss: ~str , nn : libc:: size_t ) ;
122
121
}
123
122
@@ -1998,12 +1997,18 @@ mod unsafe {
1998
1997
1999
1998
/// Appends a byte to a string. (Not UTF-8 safe).
2000
1999
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 ) ;
2002
2006
}
2003
2007
2004
2008
/// Appends a vector of bytes to a string. (Not UTF-8 safe).
2005
2009
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) ; }
2007
2012
}
2008
2013
2009
2014
/// Removes the last byte from a string and returns it. (Not UTF-8 safe).
Original file line number Diff line number Diff line change @@ -148,16 +148,6 @@ str_reserve_shared(rust_vec_box** sp,
148
148
reserve_vec_exact (task, sp, n_elts + 1 );
149
149
}
150
150
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
-
161
151
extern " C" CDECL rust_vec*
162
152
rand_seed () {
163
153
size_t size = sizeof (ub4) * RANDSIZ;
Original file line number Diff line number Diff line change @@ -38,7 +38,6 @@ rust_getcwd
38
38
rust_get_stdin
39
39
rust_get_stdout
40
40
rust_get_stderr
41
- rust_str_push
42
41
rust_list_files
43
42
rust_log_console_on
44
43
rust_log_console_off
You can’t perform that action at this time.
0 commit comments