Darwin malloc_size override support proposal.
Darwin has similar api than Linux/FreeBSD's malloc_usable_size.
This commit is contained in:
@@ -120,7 +120,7 @@ TEST_BEGIN(test_alignment_and_size) {
|
||||
"size=%zu (%#zx): %s",
|
||||
alignment, size, size, buf);
|
||||
}
|
||||
total += malloc_usable_size(ps[i]);
|
||||
total += TEST_MALLOC_SIZE(ps[i]);
|
||||
if (total >= (MAXALIGN << 1)) {
|
||||
break;
|
||||
}
|
||||
@@ -141,7 +141,7 @@ TEST_END
|
||||
TEST_BEGIN(test_zero_alloc) {
|
||||
void *res = aligned_alloc(8, 0);
|
||||
assert(res);
|
||||
size_t usable = malloc_usable_size(res);
|
||||
size_t usable = TEST_MALLOC_SIZE(res);
|
||||
assert(usable > 0);
|
||||
free(res);
|
||||
}
|
||||
|
@@ -70,7 +70,7 @@ thd_start(void *arg) {
|
||||
expect_ptr_eq(ap0, ap1,
|
||||
"Pointer returned by \"thread.allocatedp\" should not change");
|
||||
|
||||
usize = malloc_usable_size(p);
|
||||
usize = TEST_MALLOC_SIZE(p);
|
||||
expect_u64_le(a0 + usize, a1,
|
||||
"Allocated memory counter should increase by at least the amount "
|
||||
"explicitly allocated");
|
||||
|
@@ -3,7 +3,7 @@
|
||||
TEST_BEGIN(test_zero_alloc) {
|
||||
void *res = malloc(0);
|
||||
assert(res);
|
||||
size_t usable = malloc_usable_size(res);
|
||||
size_t usable = TEST_MALLOC_SIZE(res);
|
||||
assert(usable > 0);
|
||||
free(res);
|
||||
}
|
||||
|
@@ -101,7 +101,7 @@ TEST_BEGIN(test_alignment_and_size) {
|
||||
"size=%zu (%#zx): %s",
|
||||
alignment, size, size, buf);
|
||||
}
|
||||
total += malloc_usable_size(ps[i]);
|
||||
total += TEST_MALLOC_SIZE(ps[i]);
|
||||
if (total >= (MAXALIGN << 1)) {
|
||||
break;
|
||||
}
|
||||
|
@@ -185,7 +185,7 @@ TEST_BEGIN(test_align_enum) {
|
||||
assert_ptr_not_null(p,
|
||||
"Unexpected mallocx() error");
|
||||
assert_zu_eq(nallocx(1, flags),
|
||||
malloc_usable_size(p),
|
||||
TEST_MALLOC_SIZE(p),
|
||||
"Wrong mallocx() usable size");
|
||||
int flags_next =
|
||||
MALLOCX_LG_ALIGN(lg_align_next);
|
||||
@@ -193,7 +193,7 @@ TEST_BEGIN(test_align_enum) {
|
||||
assert_ptr_not_null(p,
|
||||
"Unexpected rallocx() error");
|
||||
expect_zu_eq(nallocx(size, flags_next),
|
||||
malloc_usable_size(p),
|
||||
TEST_MALLOC_SIZE(p),
|
||||
"Wrong rallocx() usable size");
|
||||
free(p);
|
||||
}
|
||||
|
Reference in New Issue
Block a user