Convert vec::{reserve, reserve_at_least, capacity} to methods.
This commit is contained in:
@@ -2081,7 +2081,7 @@ impl OwnedStr for ~str {
|
||||
pub fn reserve(&mut self, n: uint) {
|
||||
unsafe {
|
||||
let v: *mut ~[u8] = cast::transmute(self);
|
||||
vec::reserve(&mut *v, n + 1);
|
||||
(*v).reserve(n + 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2115,8 +2115,8 @@ impl OwnedStr for ~str {
|
||||
* reallocating
|
||||
*/
|
||||
fn capacity(&self) -> uint {
|
||||
let buf: &const ~[u8] = unsafe { cast::transmute(self) };
|
||||
let vcap = vec::capacity(buf);
|
||||
let buf: &~[u8] = unsafe { cast::transmute(self) };
|
||||
let vcap = buf.capacity();
|
||||
assert!(vcap > 0u);
|
||||
vcap - 1u
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user