libcore: str::push_char should use str::unsafe::set_len.
This commit is contained in:
parent
0e1a4a4da2
commit
94c3975a9a
1 changed files with 1 additions and 6 deletions
|
@ -220,14 +220,9 @@ fn push_char(&s: ~str, ch: char) {
|
||||||
*ptr::mut_offset(buf, off + 5u) =
|
*ptr::mut_offset(buf, off + 5u) =
|
||||||
(code & 63u | tag_cont) as u8;
|
(code & 63u | tag_cont) as u8;
|
||||||
}
|
}
|
||||||
*ptr::mut_offset(buf, off + nb) = 0u8;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
do as_bytes(s) |bytes| {
|
unsafe::set_len(s, new_len);
|
||||||
let mut mut_bytes: ~[u8] = ::unsafe::reinterpret_cast(bytes);
|
|
||||||
vec::unsafe::set_len(mut_bytes, new_len + 1u);
|
|
||||||
::unsafe::forget(mut_bytes);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue