Skip to content

Commit 073f360

Browse files
committed
---
yaml --- r: 12199 b: refs/heads/master c: c2f28e2 h: refs/heads/master i: 12197: 5f515a1 12195: 1f2e08a 12191: 06ffee1 v: v3
1 parent 58029c9 commit 073f360

File tree

3 files changed

+4
-11
lines changed

3 files changed

+4
-11
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 8774493dd33c0028ac7e543a88657d00c34e5eeb
2+
refs/heads/master: c2f28e231f65802d695815b6e40547b5a0e283fc
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 4a81779abd786ff22d71434c6d9a5917ea4cdfff
55
refs/heads/try: 2898dcc5d97da9427ac367542382b6239d9c0bbf

trunk/src/libcore/vec.rs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ export reserve;
1111
export reserve_at_least;
1212
export capacity;
1313
export len;
14-
export alloc_len;
1514
export from_fn;
1615
export from_elem;
1716
export to_mut;
@@ -142,6 +141,7 @@ fn reserve_at_least<T>(&v: [const T], n: uint) {
142141
#[doc = "
143142
Returns the number of elements the vector can hold without reallocating
144143
"]
144+
#[inline(always)]
145145
fn capacity<T>(&&v: [const T]) -> uint unsafe {
146146
let repr: **unsafe::vec_repr = ::unsafe::reinterpret_cast(addr_of(v));
147147
(**repr).alloc / sys::size_of::<T>()
@@ -154,13 +154,6 @@ pure fn len<T>(&&v: [const T]) -> uint unsafe {
154154
(**repr).fill / sys::size_of::<T>()
155155
}
156156

157-
#[doc = "Returns the number of bytes allocated for this vector"]
158-
#[inline(always)]
159-
pure fn alloc_len<T>(&&v: [const T]) -> uint unsafe {
160-
let repr: **unsafe::vec_repr = ::unsafe::reinterpret_cast(addr_of(v));
161-
(**repr).alloc
162-
}
163-
164157
#[doc = "
165158
Creates and initializes an immutable vector.
166159

trunk/src/libstd/arena.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ impl arena for arena {
2525
fn alloc_grow(n_bytes: uint, align: uint) -> *() {
2626
// Allocate a new chunk.
2727
let mut head = list::head(self.chunks);
28-
let chunk_size = vec::alloc_len(head.data);
28+
let chunk_size = vec::capacity(head.data);
2929
let new_min_chunk_size = uint::max(n_bytes, chunk_size);
3030
head = chunk(uint::next_power_of_two(new_min_chunk_size + 1u));
3131
self.chunks = list::cons(head, @self.chunks);
@@ -41,7 +41,7 @@ impl arena for arena {
4141
let mut start = head.fill;
4242
start = (start + alignm1) & !alignm1;
4343
let end = start + n_bytes;
44-
if end > vec::alloc_len(head.data) {
44+
if end > vec::capacity(head.data) {
4545
ret self.alloc_grow(n_bytes, align);
4646
}
4747

0 commit comments

Comments
 (0)