Skip to content

Commit a9e8510

Browse files
committed
fix sized deallocation documentation
1 parent a6426cb commit a9e8510

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

src/liballoc/heap.rs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ pub unsafe fn allocate(size: uint, align: uint) -> *mut u8 {
2828
/// size on the platform.
2929
///
3030
/// The `old_size` and `align` parameters are the parameters that were used to
31-
/// create the allocation referenced by `ptr`. The `old_size` parameter may also
32-
/// be the value returned by `usable_size` for the requested size.
31+
/// create the allocation referenced by `ptr`. The `old_size` parameter may be
32+
/// any value in range_inclusive(requested_size, usable_size).
3333
#[inline]
3434
pub unsafe fn reallocate(ptr: *mut u8, old_size: uint, size: uint, align: uint) -> *mut u8 {
3535
imp::reallocate(ptr, old_size, size, align)
@@ -57,12 +57,12 @@ pub unsafe fn reallocate_inplace(ptr: *mut u8, old_size: uint, size: uint, align
5757
///
5858
/// The `ptr` parameter must not be null.
5959
///
60-
/// The `size` and `align` parameters are the parameters that were used to
61-
/// create the allocation referenced by `ptr`. The `size` parameter may also be
62-
/// the value returned by `usable_size` for the requested size.
60+
/// The `old_size` and `align` parameters are the parameters that were used to
61+
/// create the allocation referenced by `ptr`. The `old_size` parameter may be
62+
/// any value in range_inclusive(requested_size, usable_size).
6363
#[inline]
64-
pub unsafe fn deallocate(ptr: *mut u8, size: uint, align: uint) {
65-
imp::deallocate(ptr, size, align)
64+
pub unsafe fn deallocate(ptr: *mut u8, old_size: uint, align: uint) {
65+
imp::deallocate(ptr, old_size, align)
6666
}
6767

6868
/// Returns the usable size of an allocation created with the specified the
@@ -102,8 +102,8 @@ unsafe fn exchange_malloc(size: uint, align: uint) -> *mut u8 {
102102
#[cfg(not(test))]
103103
#[lang="exchange_free"]
104104
#[inline]
105-
unsafe fn exchange_free(ptr: *mut u8, size: uint, align: uint) {
106-
deallocate(ptr, size, align);
105+
unsafe fn exchange_free(ptr: *mut u8, old_size: uint, align: uint) {
106+
deallocate(ptr, old_size, align);
107107
}
108108

109109
// The minimum alignment guaranteed by the architecture. This value is used to
@@ -185,9 +185,9 @@ mod imp {
185185
}
186186

187187
#[inline]
188-
pub unsafe fn deallocate(ptr: *mut u8, size: uint, align: uint) {
188+
pub unsafe fn deallocate(ptr: *mut u8, old_size: uint, align: uint) {
189189
let flags = align_to_flags(align);
190-
je_sdallocx(ptr as *mut c_void, size as size_t, flags)
190+
je_sdallocx(ptr as *mut c_void, old_size as size_t, flags)
191191
}
192192

193193
#[inline]
@@ -260,7 +260,7 @@ mod imp {
260260
}
261261

262262
#[inline]
263-
pub unsafe fn deallocate(ptr: *mut u8, _size: uint, _align: uint) {
263+
pub unsafe fn deallocate(ptr: *mut u8, _old_size: uint, _align: uint) {
264264
libc::free(ptr as *mut libc::c_void)
265265
}
266266

@@ -328,7 +328,7 @@ mod imp {
328328
}
329329

330330
#[inline]
331-
pub unsafe fn deallocate(ptr: *mut u8, _size: uint, align: uint) {
331+
pub unsafe fn deallocate(ptr: *mut u8, _old_size: uint, align: uint) {
332332
if align <= MIN_ALIGN {
333333
libc::free(ptr as *mut libc::c_void)
334334
} else {

0 commit comments

Comments
 (0)