Skip to content

Commit 6a2bad3

Browse files
committed
int/uint => isize/usize in liblibc/liballoc/libarena
1 parent bfdcd34 commit 6a2bad3

File tree

7 files changed

+101
-103
lines changed

7 files changed

+101
-103
lines changed

src/liballoc/arc.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -206,12 +206,12 @@ impl<T> Arc<T> {
206206
/// Get the number of weak references to this value.
207207
#[inline]
208208
#[unstable(feature = "alloc")]
209-
pub fn weak_count<T>(this: &Arc<T>) -> uint { this.inner().weak.load(SeqCst) - 1 }
209+
pub fn weak_count<T>(this: &Arc<T>) -> usize { this.inner().weak.load(SeqCst) - 1 }
210210

211211
/// Get the number of strong references to this value.
212212
#[inline]
213213
#[unstable(feature = "alloc")]
214-
pub fn strong_count<T>(this: &Arc<T>) -> uint { this.inner().strong.load(SeqCst) }
214+
pub fn strong_count<T>(this: &Arc<T>) -> usize { this.inner().strong.load(SeqCst) }
215215

216216
#[stable(feature = "rust1", since = "1.0.0")]
217217
impl<T> Clone for Arc<T> {
@@ -649,7 +649,7 @@ mod tests {
649649
let (tx, rx) = channel();
650650

651651
let _t = Thread::spawn(move || {
652-
let arc_v: Arc<Vec<int>> = rx.recv().unwrap();
652+
let arc_v: Arc<Vec<i32>> = rx.recv().unwrap();
653653
assert_eq!((*arc_v)[3], 4);
654654
});
655655

@@ -818,5 +818,5 @@ mod tests {
818818

819819
// Make sure deriving works with Arc<T>
820820
#[derive(Eq, Ord, PartialEq, PartialOrd, Clone, Debug, Default)]
821-
struct Foo { inner: Arc<int> }
821+
struct Foo { inner: Arc<i32> }
822822
}

src/liballoc/boxed_test.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ use std::boxed::BoxAny;
2222
#[test]
2323
fn test_owned_clone() {
2424
let a = Box::new(5);
25-
let b: Box<int> = a.clone();
25+
let b: Box<i32> = a.clone();
2626
assert!(a == b);
2727
}
2828

@@ -31,11 +31,11 @@ struct Test;
3131

3232
#[test]
3333
fn any_move() {
34-
let a = Box::new(8us) as Box<Any>;
34+
let a = Box::new(8) as Box<Any>;
3535
let b = Box::new(Test) as Box<Any>;
3636

37-
match a.downcast::<uint>() {
38-
Ok(a) => { assert!(a == Box::new(8us)); }
37+
match a.downcast::<i32>() {
38+
Ok(a) => { assert!(a == Box::new(8)); }
3939
Err(..) => panic!()
4040
}
4141
match b.downcast::<Test>() {
@@ -47,7 +47,7 @@ fn any_move() {
4747
let b = Box::new(Test) as Box<Any>;
4848

4949
assert!(a.downcast::<Box<Test>>().is_err());
50-
assert!(b.downcast::<Box<uint>>().is_err());
50+
assert!(b.downcast::<Box<i32>>().is_err());
5151
}
5252

5353
#[test]

src/liballoc/heap.rs

Lines changed: 44 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use core::ptr::PtrExt;
2121
/// power of 2. The alignment must be no larger than the largest supported page
2222
/// size on the platform.
2323
#[inline]
24-
pub unsafe fn allocate(size: uint, align: uint) -> *mut u8 {
24+
pub unsafe fn allocate(size: usize, align: usize) -> *mut u8 {
2525
imp::allocate(size, align)
2626
}
2727

@@ -37,7 +37,7 @@ pub unsafe fn allocate(size: uint, align: uint) -> *mut u8 {
3737
/// create the allocation referenced by `ptr`. The `old_size` parameter may be
3838
/// any value in range_inclusive(requested_size, usable_size).
3939
#[inline]
40-
pub unsafe fn reallocate(ptr: *mut u8, old_size: uint, size: uint, align: uint) -> *mut u8 {
40+
pub unsafe fn reallocate(ptr: *mut u8, old_size: usize, size: usize, align: usize) -> *mut u8 {
4141
imp::reallocate(ptr, old_size, size, align)
4242
}
4343

@@ -54,7 +54,8 @@ pub unsafe fn reallocate(ptr: *mut u8, old_size: uint, size: uint, align: uint)
5454
/// create the allocation referenced by `ptr`. The `old_size` parameter may be
5555
/// any value in range_inclusive(requested_size, usable_size).
5656
#[inline]
57-
pub unsafe fn reallocate_inplace(ptr: *mut u8, old_size: uint, size: uint, align: uint) -> uint {
57+
pub unsafe fn reallocate_inplace(ptr: *mut u8, old_size: usize, size: usize,
58+
align: usize) -> usize {
5859
imp::reallocate_inplace(ptr, old_size, size, align)
5960
}
6061

@@ -66,14 +67,14 @@ pub unsafe fn reallocate_inplace(ptr: *mut u8, old_size: uint, size: uint, align
6667
/// create the allocation referenced by `ptr`. The `old_size` parameter may be
6768
/// any value in range_inclusive(requested_size, usable_size).
6869
#[inline]
69-
pub unsafe fn deallocate(ptr: *mut u8, old_size: uint, align: uint) {
70+
pub unsafe fn deallocate(ptr: *mut u8, old_size: usize, align: usize) {
7071
imp::deallocate(ptr, old_size, align)
7172
}
7273

7374
/// Returns the usable size of an allocation created with the specified the
7475
/// `size` and `align`.
7576
#[inline]
76-
pub fn usable_size(size: uint, align: uint) -> uint {
77+
pub fn usable_size(size: usize, align: usize) -> usize {
7778
imp::usable_size(size, align)
7879
}
7980

@@ -96,7 +97,7 @@ pub const EMPTY: *mut () = 0x1 as *mut ();
9697
#[cfg(not(test))]
9798
#[lang="exchange_malloc"]
9899
#[inline]
99-
unsafe fn exchange_malloc(size: uint, align: uint) -> *mut u8 {
100+
unsafe fn exchange_malloc(size: usize, align: usize) -> *mut u8 {
100101
if size == 0 {
101102
EMPTY as *mut u8
102103
} else {
@@ -109,7 +110,7 @@ unsafe fn exchange_malloc(size: uint, align: uint) -> *mut u8 {
109110
#[cfg(not(test))]
110111
#[lang="exchange_free"]
111112
#[inline]
112-
unsafe fn exchange_free(ptr: *mut u8, old_size: uint, align: uint) {
113+
unsafe fn exchange_free(ptr: *mut u8, old_size: usize, align: usize) {
113114
deallocate(ptr, old_size, align);
114115
}
115116

@@ -122,49 +123,49 @@ unsafe fn exchange_free(ptr: *mut u8, old_size: uint, align: uint) {
122123
target_arch = "mips",
123124
target_arch = "mipsel",
124125
target_arch = "powerpc")))]
125-
const MIN_ALIGN: uint = 8;
126+
const MIN_ALIGN: usize = 8;
126127
#[cfg(all(not(feature = "external_funcs"),
127128
not(feature = "external_crate"),
128129
any(target_arch = "x86",
129130
target_arch = "x86_64",
130131
target_arch = "aarch64")))]
131-
const MIN_ALIGN: uint = 16;
132+
const MIN_ALIGN: usize = 16;
132133

133134
#[cfg(feature = "external_funcs")]
134135
mod imp {
135136
extern {
136-
fn rust_allocate(size: uint, align: uint) -> *mut u8;
137-
fn rust_deallocate(ptr: *mut u8, old_size: uint, align: uint);
138-
fn rust_reallocate(ptr: *mut u8, old_size: uint, size: uint, align: uint) -> *mut u8;
139-
fn rust_reallocate_inplace(ptr: *mut u8, old_size: uint, size: uint,
140-
align: uint) -> uint;
141-
fn rust_usable_size(size: uint, align: uint) -> uint;
137+
fn rust_allocate(size: usize, align: usize) -> *mut u8;
138+
fn rust_deallocate(ptr: *mut u8, old_size: usize, align: usize);
139+
fn rust_reallocate(ptr: *mut u8, old_size: usize, size: usize, align: usize) -> *mut u8;
140+
fn rust_reallocate_inplace(ptr: *mut u8, old_size: usize, size: usize,
141+
align: usize) -> usize;
142+
fn rust_usable_size(size: usize, align: usize) -> usize;
142143
fn rust_stats_print();
143144
}
144145

145146
#[inline]
146-
pub unsafe fn allocate(size: uint, align: uint) -> *mut u8 {
147+
pub unsafe fn allocate(size: usize, align: usize) -> *mut u8 {
147148
rust_allocate(size, align)
148149
}
149150

150151
#[inline]
151-
pub unsafe fn deallocate(ptr: *mut u8, old_size: uint, align: uint) {
152+
pub unsafe fn deallocate(ptr: *mut u8, old_size: usize, align: usize) {
152153
rust_deallocate(ptr, old_size, align)
153154
}
154155

155156
#[inline]
156-
pub unsafe fn reallocate(ptr: *mut u8, old_size: uint, size: uint, align: uint) -> *mut u8 {
157+
pub unsafe fn reallocate(ptr: *mut u8, old_size: usize, size: usize, align: usize) -> *mut u8 {
157158
rust_reallocate(ptr, old_size, size, align)
158159
}
159160

160161
#[inline]
161-
pub unsafe fn reallocate_inplace(ptr: *mut u8, old_size: uint, size: uint,
162-
align: uint) -> uint {
162+
pub unsafe fn reallocate_inplace(ptr: *mut u8, old_size: usize, size: usize,
163+
align: usize) -> usize {
163164
rust_reallocate_inplace(ptr, old_size, size, align)
164165
}
165166

166167
#[inline]
167-
pub fn usable_size(size: uint, align: uint) -> uint {
168+
pub fn usable_size(size: usize, align: usize) -> usize {
168169
unsafe { rust_usable_size(size, align) }
169170
}
170171

@@ -215,42 +216,42 @@ mod imp {
215216

216217
// MALLOCX_ALIGN(a) macro
217218
#[inline(always)]
218-
fn mallocx_align(a: uint) -> c_int { a.trailing_zeros() as c_int }
219+
fn mallocx_align(a: usize) -> c_int { a.trailing_zeros() as c_int }
219220

220221
#[inline(always)]
221-
fn align_to_flags(align: uint) -> c_int {
222+
fn align_to_flags(align: usize) -> c_int {
222223
if align <= MIN_ALIGN { 0 } else { mallocx_align(align) }
223224
}
224225

225226
#[inline]
226-
pub unsafe fn allocate(size: uint, align: uint) -> *mut u8 {
227+
pub unsafe fn allocate(size: usize, align: usize) -> *mut u8 {
227228
let flags = align_to_flags(align);
228229
je_mallocx(size as size_t, flags) as *mut u8
229230
}
230231

231232
#[inline]
232-
pub unsafe fn reallocate(ptr: *mut u8, _old_size: uint, size: uint, align: uint) -> *mut u8 {
233+
pub unsafe fn reallocate(ptr: *mut u8, _old_size: usize, size: usize, align: usize) -> *mut u8 {
233234
let flags = align_to_flags(align);
234235
je_rallocx(ptr as *mut c_void, size as size_t, flags) as *mut u8
235236
}
236237

237238
#[inline]
238-
pub unsafe fn reallocate_inplace(ptr: *mut u8, _old_size: uint, size: uint,
239-
align: uint) -> uint {
239+
pub unsafe fn reallocate_inplace(ptr: *mut u8, _old_size: usize, size: usize,
240+
align: usize) -> usize {
240241
let flags = align_to_flags(align);
241-
je_xallocx(ptr as *mut c_void, size as size_t, 0, flags) as uint
242+
je_xallocx(ptr as *mut c_void, size as size_t, 0, flags) as usize
242243
}
243244

244245
#[inline]
245-
pub unsafe fn deallocate(ptr: *mut u8, old_size: uint, align: uint) {
246+
pub unsafe fn deallocate(ptr: *mut u8, old_size: usize, align: usize) {
246247
let flags = align_to_flags(align);
247248
je_sdallocx(ptr as *mut c_void, old_size as size_t, flags)
248249
}
249250

250251
#[inline]
251-
pub fn usable_size(size: uint, align: uint) -> uint {
252+
pub fn usable_size(size: usize, align: usize) -> usize {
252253
let flags = align_to_flags(align);
253-
unsafe { je_nallocx(size as size_t, flags) as uint }
254+
unsafe { je_nallocx(size as size_t, flags) as usize }
254255
}
255256

256257
pub fn stats_print() {
@@ -277,7 +278,7 @@ mod imp {
277278
}
278279

279280
#[inline]
280-
pub unsafe fn allocate(size: uint, align: uint) -> *mut u8 {
281+
pub unsafe fn allocate(size: usize, align: usize) -> *mut u8 {
281282
if align <= MIN_ALIGN {
282283
libc::malloc(size as libc::size_t) as *mut u8
283284
} else {
@@ -294,7 +295,7 @@ mod imp {
294295
}
295296

296297
#[inline]
297-
pub unsafe fn reallocate(ptr: *mut u8, old_size: uint, size: uint, align: uint) -> *mut u8 {
298+
pub unsafe fn reallocate(ptr: *mut u8, old_size: usize, size: usize, align: usize) -> *mut u8 {
298299
if align <= MIN_ALIGN {
299300
libc::realloc(ptr as *mut libc::c_void, size as libc::size_t) as *mut u8
300301
} else {
@@ -306,18 +307,18 @@ mod imp {
306307
}
307308

308309
#[inline]
309-
pub unsafe fn reallocate_inplace(_ptr: *mut u8, old_size: uint, _size: uint,
310-
_align: uint) -> uint {
310+
pub unsafe fn reallocate_inplace(_ptr: *mut u8, old_size: usize, _size: usize,
311+
_align: usize) -> usize {
311312
old_size
312313
}
313314

314315
#[inline]
315-
pub unsafe fn deallocate(ptr: *mut u8, _old_size: uint, _align: uint) {
316+
pub unsafe fn deallocate(ptr: *mut u8, _old_size: usize, _align: usize) {
316317
libc::free(ptr as *mut libc::c_void)
317318
}
318319

319320
#[inline]
320-
pub fn usable_size(size: uint, _align: uint) -> uint {
321+
pub fn usable_size(size: usize, _align: usize) -> usize {
321322
size
322323
}
323324

@@ -341,7 +342,7 @@ mod imp {
341342
}
342343

343344
#[inline]
344-
pub unsafe fn allocate(size: uint, align: uint) -> *mut u8 {
345+
pub unsafe fn allocate(size: usize, align: usize) -> *mut u8 {
345346
if align <= MIN_ALIGN {
346347
libc::malloc(size as size_t) as *mut u8
347348
} else {
@@ -350,7 +351,7 @@ mod imp {
350351
}
351352

352353
#[inline]
353-
pub unsafe fn reallocate(ptr: *mut u8, _old_size: uint, size: uint, align: uint) -> *mut u8 {
354+
pub unsafe fn reallocate(ptr: *mut u8, _old_size: usize, size: usize, align: usize) -> *mut u8 {
354355
if align <= MIN_ALIGN {
355356
libc::realloc(ptr as *mut c_void, size as size_t) as *mut u8
356357
} else {
@@ -359,13 +360,13 @@ mod imp {
359360
}
360361

361362
#[inline]
362-
pub unsafe fn reallocate_inplace(_ptr: *mut u8, old_size: uint, _size: uint,
363-
_align: uint) -> uint {
363+
pub unsafe fn reallocate_inplace(_ptr: *mut u8, old_size: usize, _size: usize,
364+
_align: usize) -> usize {
364365
old_size
365366
}
366367

367368
#[inline]
368-
pub unsafe fn deallocate(ptr: *mut u8, _old_size: uint, align: uint) {
369+
pub unsafe fn deallocate(ptr: *mut u8, _old_size: usize, align: usize) {
369370
if align <= MIN_ALIGN {
370371
libc::free(ptr as *mut libc::c_void)
371372
} else {
@@ -374,7 +375,7 @@ mod imp {
374375
}
375376

376377
#[inline]
377-
pub fn usable_size(size: uint, _align: uint) -> uint {
378+
pub fn usable_size(size: usize, _align: usize) -> usize {
378379
size
379380
}
380381

src/liballoc/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@
7070
#![feature(lang_items, unsafe_destructor)]
7171
#![feature(box_syntax)]
7272
#![feature(optin_builtin_traits)]
73-
#![feature(int_uint)]
7473
#![feature(unboxed_closures)]
7574
#![feature(core)]
7675
#![feature(hash)]

0 commit comments

Comments
 (0)